I have simple code to generate hash code using SHA256, however, it gives different result for the same input. However, if I declare the same string value in quotes for example _input= "test" then it returns the same result.
public static System.String generateKey(System.String _input)
{
System.Byte[] convertedArr;
SHA256Managed sh = new System.Security.Cryptography.SHA256Managed();
convertedArr = sh.ComputeHash(System.Text.Encoding::UTF8.GetBytes(_inputString),0, System.Text.Encoding::UTF8.GetByteCount(_input));
hashCode = System.Convert::ToBase64String(convertedArr);
return hashCode;
}
_input? - aaronFNSGenerateHashDetailsmaybe add some "salt" to the hash input? - Martin UllrichFNSGenerateHashDetails::GetBytesandSystem.Text.Encoding::UTF8.GetByteCount. Terse and to debug code is not leet. - zaph