I know very little about encryption/hashing.
I have to hash an encryption key. The example in Java is like this...
String encryptionKey = \"test\";
Actually, the results are identical. Like other integral types, a byte value may be interpreted as either signed or unsigned. For example, 10001111
would correspond to 143
(your second C# value) if interpreted as unsigned. However, if interpreted as signed (using two’s complement), its value would be -113
(your second Java value).
Thus, the disparity seems to be caused by your values being formatted as signed in Java but unsigned in C#. If you want to get signed bytes in C#, you can use:
sbyte[] encryptionKeyBytesSigned =
encryptionKeyBytes.Select(b => (sbyte)b).ToArray();
However, be careful that this is not merely a formatting issue that only arises when you display your values. When saved to file, both results should be identical.