md5 differences

Grant Edwards grante at visi.com
Wed Sep 10 19:39:24 CEST 2008


On 2008-09-10, Wojtek Walczak <gminick at bzt.bzt> wrote:
> 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.

Same here.

-- 
Grant Edwards                   grante             Yow! What PROGRAM are they
                                  at               watching?
                               visi.com            



More information about the Python-list mailing list