md5.hexdigest() converting unicode string to ascii

Heather Coppersmith me at privacy.net
Wed Apr 21 06:46:30 EDT 2004


On 20 Apr 2004 16:16:33 -0700,
mgibson at tripwire.com (uebertester) wrote:

> I've attempted the suggested solution specifying different
> encodings, however, the hash value that is returned does not
> match what I expect based upon another utility I'm checking
> against.  Hash value returned by python specifying utf16
> encoding: 731f46dd88cb3a67a4ee1392aa84c6f4 .  Hash value
> returned by other utility:  0b0ebc769e2b89cf61a10a72d5a11dda .
> Note:  I've tried other encoding also.  As the utility I'm
> verifying against is extensively used, I'm assuming it is
> returning the correct value.  I appreciate any help in resolving
> this as I'm trying to enhance an automated test suite written in
> python.

Other things that may bite or may have bitten you:

    o the byte order marker or lack thereof
    o different newline conventions
    o trailing newlines or lack thereof
    o don't forget that there are two utf16 encodings, big endian
        and little endian

Adding to what Peter indicated, the source (code and/or persons)
of your extensively used utility may also contain specific test
vectors.

Regards,
Heather

-- 
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli



More information about the Python-list mailing list