SHA-1 Hash in Java and .NET
843810Jul 1 2002 — edited Jul 2 2002I am comparing SHA-1 hashes generated in Java and .NET. Unless I'm mistaken, a byte stream supplied to one SHA-1 implementation should generate the same message digest to any other SHA-1 implementation.
For java I am using the Sun provider SunJCE built into the 1.4 SDK.
For .NET, I am using the SHA1CryptoServiceProvider.
I am supplying each with the same byte stream; the US-ASCII byte stream for "abc" = {97, 98, 99}.
The SunJCE message digest (in bytes) are:
-87 -103 62 54 71 6 -127 106 -70 62 37 113 120 80 -62 108 -100 -48 -40 -99
The .NET message digest (in bytes) are:
169 153 62 54 71 6 129 106 186 62 37 113 120 80 194 108 156 208 216 157
Does anyone know why the two implementations do not produce the same message digests?
Ricky
rzeng@mindspring.com