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
hexString.append(Integer.toHexString(0xFF & hash[i]));
You are building the hash string incorrectly. Integer.toHexString
does not include leading zeros, so while Integer.toHexString(0xFF) == "FF"
, the problem is that Integer.toHexString(0x05) == "5"
.
Suggested correction: String.format("%02x", hash[i] & 0xFF)