I want to convert a some code which is in Java to C#.
Java Code:
private static final byte[] SALT = \"NJui8*&N823bVvy03^4N\".getBytes();
public
You didn't really write how you called the SimpleHash class - with which parameters and such.
But note that its ComputeHash
method has in its documentation:
Hash value formatted as a base64-encoded string.
Your class instead formats the output in hexadecimal, which will obviously be different.
Also, the salt is in SimpleHash interpreted as base64, while your method interprets it as ASCII (or whatever your system encoding is - most probably something ASCII-compatible, and the string only contains ASCII characters).
Also, the output in SimpleHash includes the salt (to allow reproducing it for the "verify" part when using random salt), which it doesn't in your method.
(More points are already mentioned by the other answers.)