The code below is giving me a string for "HashedResult" which ends with a "=" or "= =". Searches inform me that this is padding. What do I need to do specifically to get a full string without the padding? I want to append this SHA512 string to a random salt string so that I can use for password purposes. Seems to me I am giving away some secrecy if it is obvious how much of the total string is the password hash by the "= =" in the middle of my string. I could do something to get rid of the last 2-3 characters - but is there something that I am supposed to do to avoid the need of the padding in the first place?
Code:private void Btn_Login_Click(object sender, EventArgs e) { string userPassword = Txt_Password.Text; var hashedResult = Hash.HashThis(userPassword); MessageBox.Show(hashedResult); } class Hash { public static string HashThis(string StrText) { { var UTF8EncodedBytesOfStrText = System.Text.Encoding.UTF8.GetBytes(StrText); using (var HASH = System.Security.Cryptography.SHA512.Create()) { var hashedUTF8EncodedBytesOfStrText = HASH.ComputeHash(UTF8EncodedBytesOfStrText); return System.Convert.ToBase64String(hashedUTF8EncodedBytesOfStrText); } } }


Reply With Quote
