I’m using hexdigest in Digest/MD5 but got totally different outputs from
other tools.
I got some clues that in windows I should read the source I would like
to hash with binary mode.
But I have no idea how to transform a string to binary mode.
Anyone could give my some suggestion?
I’m using hexdigest in Digest/MD5 but got totally different outputs from
other tools.
I got some clues that in windows I should read the source I would like
to hash with binary mode.
But I have no idea how to transform a string to binary mode.
Anyone could give my some suggestion?
Try:
p my_string.split(//)
and see if you get the same sequence of bytes you expect other
tools to see. Also try “puts my_string.size” to verify the byte
count.
On Fri, Mar 30, 2007 at 12:13:14PM +0900, Bontina C. wrote:
I’m using hexdigest in Digest/MD5 but got totally different outputs from
other tools.
I got some clues that in windows I should read the source I would like
to hash with binary mode.
But I have no idea how to transform a string to binary mode.
Anyone could give my some suggestion?
Your sources must be byte-for-byte identical, including any newlines.
e.g.
echo “hello” | md5sum
echo -n “hello” | md5sum
will give different answers.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.