md5 differences

Python python at rgbaz.eu
Wed Sep 10 19:51:36 CEST 2008


On 10 sep 2008, at 19:39, Grant Edwards wrote:

> 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

thanks everyone for helping me out!

cheers
Arno




More information about the Python-list mailing list