md5 wrongness?

Ron Johnson ron.l.johnson at cox.net
Sat Nov 24 03:34:04 CET 2007


Why do Python's md5 and GNU md5sum produce differing results?

$ md5sum --version
md5sum (GNU coreutils) 5.97

$ echo snagglefrob | md5sum
f842244d79af85b457811091319d85ff  -
$ echo 'snagglefrob' | md5sum
f842244d79af85b457811091319d85ff  -
$ echo "snagglefrob" | md5sum
f842244d79af85b457811091319d85ff  -


$ python
Python 2.4.4 (#2, Aug 16 2007, 02:03:40)
[GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import md5
>>> s = md5.new()
>>> s.update('snagglefrob')
>>> s.hexdigest()
'9eb2459fcdd9f9b8a9fef7348bcac933'

-- 
Ron Johnson, Jr.
Jefferson LA  USA

%SYSTEM-F-FISH, my hovercraft is full of eels



More information about the Python-list mailing list