[issue27925] Nicer interface to convert hashlib digests to int

Serhiy Storchaka report at bugs.python.org
Thu Sep 1 15:41:46 EDT 2016


Serhiy Storchaka added the comment:

There is another way:

    int.from_bytes(x.digest(), 'big')

Note that converting to int you lose the length of the digest. md5 digest d41d8cd98f00b204e9800998ecf8427e and sha1 digest 00000000d41d8cd98f00b204e9800998ecf8427e are converted to the same int. This can add a vulnerability.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27925>
_______________________________________


More information about the Python-bugs-list mailing list