On 2008-09-10, Python <[EMAIL PROTECTED]> wrote: > > On 10 sep 2008, at 18:30, Richard Brodie wrote: > >> >> "Python" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>> here's an example: >>> [EMAIL PROTECTED]:~% echo "hello" | md5 >>> b1946ac92492d2347c6235b4d2611184 >>> How do I get the same results? >> >> Checksum the same string. >> >>>>> md5.new("hello\n").hexdigest() >> 'b1946ac92492d2347c6235b4d2611184' >> >> > > hmm and this then: > > [EMAIL PROTECTED]:~% echo "test" > test.txt > > [EMAIL PROTECTED]:~% md5 test.txt > MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249 > > [EMAIL PROTECTED]:~% python > Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import md5 > >>> md5.new("/Volumes/data/Arno/test.txt").hexdigest() > '90364ed45b452d43378629c20543a81d'
That's the digest of the string "/Volumes/data/Arno/test.txt". It's not supposed to match the digest of the string "test\n". >>> md5.new(open("test.txt").read()).hexdigest() 'd8e8fca2dc0f896fd7cb4cb0031ba249' $ md5sum test.txt d8e8fca2dc0f896fd7cb4cb0031ba249 test.txt $ echo "test" | md5sum d8e8fca2dc0f896fd7cb4cb0031ba249 - >>> md5.new("test\n").hexdigest() 'd8e8fca2dc0f896fd7cb4cb0031ba249' > even > echo -n "hello" | md5 > doesn't return the same number Not the same as _what_? >>> md5.new("test").hexdigest() '098f6bcd4621d373cade4e832627b4f6' $ echo -n test | md5sum 098f6bcd4621d373cade4e832627b4f6 - -- Grant Edwards grante Yow! One FISHWICH coming at up!! visi.com -- http://mail.python.org/mailman/listinfo/python-list