Re: SHA256 error?
Guido van Rossum <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
I seem to recall hearing about this bug. The current hashlib of the python 2.5 development version doesn't have this bug though. --Guido On 4/3/06, Marcin Wudarczyk <[email protected]> wrote: > Hello, > > > I think I have found a problem in the PyCrypto. The following code: > > from Crypto.Hash import SHA256 > import sha > > c = chr(97)* 631 > dig = SHA256.new(c).digest() > #print the digest in hex > print reduce(lambda x, y: x + ("%02x" % ord(y)), dig, "") > > > run against Python2.4 and PyCrypto 2.0.1 (installed from binaries on > Windows) gives me : > > > 3d0d90e19300f382f39ed71f44077e08aa6a7014fb85de6a0dbaad3065331ade > > > while the result I receive on the site http://www.fileformat.info/tool/ > and with Crypto++ library is: > > 3585ed0d637adeac97def14b28180016e92357d0d4f0b6e86c4821c507d9ff96 > > This problem only concerns string with the length of exactly 631 chars > with any contents. For other lenghths the outcomes of all three methods > are the same. > > Any ideas? Is it a bug of PyCrypto or am I doing something wrong? > > Cheers. > > Marcinra > -- --Guido van Rossum (home page: http://www.python.org/~guido/)