[Possible Bug-Python2.3.2] MD5 module?

Peter L Hansen peter at engcorp.com
Wed Oct 13 20:26:48 EDT 2004


Jean-Guillaume Paradis wrote:
> Hi,
> 
>    I've tried to use the md5 module of python 2.3.3, and the results of 
> a hash do not concord with those of reference sites such as 
> http://bfl.rctek.com/tools/?tool=hasher
> 
>    I call it using
> 
>    import md5
>    m = md5.new()
>    m.update("a")
>    print m.hexdigest()
> 
> 
>    I have not checked if the problem is the same on more recent version 
> though

Try again.  The two examples you cite, though you for some reason
didn't bother showing your actual output, both produce the same
result for me, namely:

 >>> import md5
 >>> m = md5.new()
 >>> m.update('a')
 >>> print m.hexdigest()
0cc175b9c0f1b6a831c399e269772661


And from the source for the rctek.com web page mentioned above, aftering
entering "a" in the box:

<label for="string">Enter a string to hash:
<input type="text" id="string" name="string" value="a" /></label>
<input type="submit" value="Submit" class="submit" />
<label for="hash">Hash of string:
<input type="text" id="hash" value="0cc175b9c0f1b6a831c399e269772661" 
readonly="readonly" /></label>


-Peter



More information about the Python-list mailing list