md5.hexdigest() converting unicode string to ascii
uebertester
mgibson at tripwire.com
Wed Apr 21 13:19:25 EDT 2004
Heather Coppersmith <me at privacy.net> wrote in message news:<m2zn957gmx.fsf at unique.phony.fqdn>...
> 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
Your first bullet is the problem. _winreg.QueryValueEx(y,"") returns
a unicode string with the BOM "fffe". The utility I'm comparing
against removes this prior to hashing the registry value. Thanks for
all the input I received from everyone.
Mark
More information about the Python-list
mailing list