Posted on: 11/14/2013 4:25:08 PM | Views : 828

Hi,
Converting Java code to VB.Net and all works fine bar one call to System.Security.Cryptography.SHA1Managed.ComputeHash
The code below is the Java that I am having trouble with and is fixed because it is out of our control.
MessageDigest md = MessageDigest.getInstance("SHA-1"); md.reset(); md.update(phrase); byte[] digest = md.digest(); Now, I have replicated this code in VB.Net, but the fundamental issue is the fact that a Byte in Java is a signed value ranging between -127 and 127, whereas a byte in VB.Net is an unsigned value ranging between 0 and 256.
Now I have so far got around this by simply creating an SByte array and checking to see if the value held is greater then 127, if it is, then subtract 256. Sorted.
The problem I am having is based around the ComputeHash. It only takes a Byte array as its parameter. Trouble is if I convert an SByte array that hold a negative value, then th ...

Go to the complete details ...