If I want the following result :
RIPEMD-160("The quick brown fox jumps over the lazy dog") =
37f332f68db77bd9d7edd4969571ad671cf9dd3b
I tried this :
string hash11 = System.Text.Encoding.ASCII.GetString(RIPEMD.ComputeHash(Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog")));
but it doesn't give me the previous result!
The ComputeHash function gives you a byte array with the values in it (0x37, 0xF3, ...). If you use GetString it will take every value in the byte and use the character with that value, it will not convert the value into a string.
You could convert it like that:
var bytes = RIPEMD.ComputeHash(Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog"));
string hash11 = "";
foreach(var curByte in bytes)
hash11 = curByte.ToString("X2") + hash11; // or curByte.ToString("X") if for example 9 should not get 09
Like that you have the highest byte at the beginning. With
hash11 += curByte.ToString("X2")
you have the lowest byte at the beginning.