Password Encryption- MD5 4GL vs Java

lucianors

New Member
Hello.

I am working on a Java frontend to a Progress application.
I couldn't find an encryption function to use on SQL to match the stored passwords with JDBC, so i asked the user to change the 4GL program to store passwords on MD5 format.

So far so good, but i can't get the MD5 digests be equal on both sides.

Progress:
def var x as raw.
def var y as longchar.
def var z as char.

x = md5-digest("123456").
y = hex-encode(x).
z = y.
display z format "x(40)"

Result: e10adc3949ba59abbe56e057f20f883e

Java:
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.digest("123456".getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
return hash.toString(16);

Result: d41d8cd98f00b204e9800998ecf8427e

Does anyone have a clue on what may be wrong? The Java side seems to be absolutely right. If not, any other idea on how i could encrypt the password from JDBC side to compare with database value?

Thank you!
 
well Java isn't wrong either... could happen to anyone :)

Code:
MessageDigest md5 = MessageDigest.getInstance("MD5");
BigInteger hash = new BigInteger(1, md5.digest("123456".getBytes()));
return hash.toString(16);
 
Back
Top