md5 differences
Wojtek Walczak
gminick at bzt.bzt
Wed Sep 10 13:37:27 EDT 2008
On Wed, 10 Sep 2008 19:12:28 +0200, Python wrote:
> Arno at Computer:~% echo "test" > test.txt
>
> Arno at Computer:~% md5 test.txt
> MD5 (test.txt) = d8e8fca2dc0f896fd7cb4cb0031ba249
> >>> import md5
> >>> md5.new("/Volumes/data/Arno/test.txt").hexdigest()
> '90364ed45b452d43378629c20543a81d'
Works for me:
>>> import md5
>>> f = open('test.txt').read()
>>> md5.new(f).hexdigest()
'd8e8fca2dc0f896fd7cb4cb0031ba249'
>>>
IOW, don't pass the path to the file to md5.new, but the contents
of this file.
The strange thing is that
>>> md5.new("/Volumes/data/Arno/test.txt").hexdigest()
returns '8dd66a1592e2a8c3ab160822fb237f4d' on my machine.
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
More information about the Python-list
mailing list