Click here to Skip to main content
15,745,574 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
string password = hash + salt
byte[] hashsalt = hashing.ComputeHash(Encoding.UTF8.GetBytes(password));

what is the code if you want convert from
byte[] hashsalt = hashing.ComputeHash(Encoding.UTF8.GetBytes(password));
to a string variable
Updated 15-Jul-14 3:32am
[no name] 15-Jul-14 9:29am
Richard MacCutchan 15-Jul-14 9:51am    
You should never need to. Passwords (especially salted ones) are hashed (which is one way only) to ensure they cannot be cracked.
Thanks7872 15-Jul-14 10:42am    
Its always advised to explain the actual problem and not to assume that we can read your mind. You should explain what you are trying to do in this case in order to get proper solution.
Sergey Alexandrovich Kryukov 15-Jul-14 11:53am    
I answered, but your concatenation "trick" (hash + salt) looks totally pointless or at least unclear. What are you trying to achieve with that?


var str=System.Text.Encoding.UTF8.GetString([Your Byte Array]);

Link for More details :[^]
Share this answer
Sergey Alexandrovich Kryukov 15-Jul-14 11:46am    
It doesn't solve the OP's problem in any way; it may seem relevant only due to OP's misconception about the hash, which you did not even try to address. Please see my answer to understand it.
Suvabrata Roy 16-Jul-14 0:24am    
Question has been modified what v1 question was clearly try to know who to convert a bit array to string, Yes you are rite I did not try to understand why he required so.
polkj 16-Jul-14 9:44am    
I trying store the hash into a string
Suvabrata Roy 16-Jul-14 9:59am    
Read it :
Hash, more exactly, cryptographic hash function, is irreversible. It means it is cryptographically infeasible to obtain original piece of data from its hash. This is the whole purpose! Would would need to use such a function in cryptography is reverse operation was feasible? Just think about it.

See also:[^].

Are you getting it?

The usage is: get a hash of a password from the user and store it. You will never know the password itself; you have no right to know it and you never need it for authentication. For authentication, you get a hash from the user and compare it with the hash you store for this user account.

Share this answer
polkj 15-Jul-14 12:31pm    
But hash passwords and salt usually store in strings
Dave Kreskowiak 15-Jul-14 12:39pm    
So f'ing what? And hashes are usually stored as byte arrays, not strings.

You obviously have no idea what a cryptographic hash is.

A hash is a lossy algorithm that generates a value that can NOT be turned back into the string it was derived from. Security like that is the entire point of using a hash!
Sergey Alexandrovich Kryukov 15-Jul-14 13:40pm    
I must agree with you... :-)
Dave Kreskowiak 15-Jul-14 14:13pm    
Sometimes I have to cry looking at the state of this industry and the direction it's going.
Sergey Alexandrovich Kryukov 15-Jul-14 17:05pm    
This is a rather surprising confession from you, but I must say I often feel the same. My view is maybe more optimistic: I clearly see some progress, and, if the general culture decline, this is some "en mass" phenomenon. If you look at 99% of the software crafts, it looks very sad, frustrating. But this is a matter of having the rest 1% (or, who knows how much? it depends on what metrics do you compare) and our ability to stay in healthy 1%. Perhaps not very encouraging, but I think it make sense.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900