MD5 16 octet - how to compute?

S

Shuaib Zahda

Hi there

I am trying to compute the 16 octet MD5 hash.
I looked in the digest/md5 and i could not figure it out.
i used Digest::MD5.hexdigest(value)
but this computes 32 if I am not mistaken.

Any idea please?
 
M

Michael Fellinger

Hi there

I am trying to compute the 16 octet MD5 hash.
I looked in the digest/md5 and i could not figure it out.
i used Digest::MD5.hexdigest(value)
but this computes 32 if I am not mistaken.

Any idea please?

MD5 computes a 128bit hash.
If you use MD5.hexdigest, you will get a String representation in base
16, so it's 32 octets.
You could use MD5.digest instead, which returns a String in base 255,
that means it's 16 octets.
 
S

Shuaib Zahda

Michael said:
MD5 computes a 128bit hash.
If you use MD5.hexdigest, you will get a String representation in base
16, so it's 32 octets.
You could use MD5.digest instead, which returns a String in base 255,
that means it's 16 octets.

Michael thank you very much, you saved me a lot of time. It took me
hours to find this out and now my application is working

thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,087
Members
48,773
Latest member
Kaybee

Latest Threads

Top