|AHHH. Damn and blast. David beat me to it.
Yeah, hes right. Yours isn't the best way of doing it.
public string test2(string strBoxPassword)
byte bPassword = System.Text.Encoding.Default.GetBytes(strBoxPassword);
System.Security.Cryptography.SHA1 shaM = new System.Security.Cryptography.SHA1Managed();
byte hash = shaM.ComputeHash(bPassword);
Note that this and Davids reply are pretty similar except he excplicitly speficies the Unicode encoder. However, please note that both these methods WILL NOT return the same hash as your old method. The reason beeing is that you hard code 50 characters in the source byte array no matter what the actual length is. Our methods only hash the actual contents of the data and no extra trailing bytes.
Therefore if you already have hashes in your DB based on the originial code your probably going to have to either stick with what you have or re generate all the hashes...
Insert Sig. Here!