From mar at NGLOGIC.COM Mon Apr 3 16:35:44 2006 From: mar at NGLOGIC.COM (Marcin Wudarczyk) Date: Mon, 3 Apr 2006 16:35:44 +0200 Subject: [PYTHON-CRYPTO] SHA256 error? Message-ID: <443132C0.8040807@nglogic.com> 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 From guido at PYTHON.ORG Mon Apr 3 17:45:45 2006 From: guido at PYTHON.ORG (Guido van Rossum) Date: Mon, 3 Apr 2006 08:45:45 -0700 Subject: [PYTHON-CRYPTO] SHA256 error? In-Reply-To: <443132C0.8040807@nglogic.com> References: <443132C0.8040807@nglogic.com> Message-ID: 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 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/) From heikki at OSAFOUNDATION.ORG Tue Apr 4 20:49:13 2006 From: heikki at OSAFOUNDATION.ORG (Heikki Toivonen) Date: Tue, 4 Apr 2006 11:49:13 -0700 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update Message-ID: <4432BFA9.8040804@osafoundation.org> Good news: I'll be able to spend 20% of my office time on shipping M2Crypto 0.16. Because of this additional time I have moved the release earlier. The plan is to stop new development on June 1, and start doing weekly release candidates. I expect to ship the final release by the end of June. To see the list of remaining bugs to be fixed etc. visit http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto -- Heikki Toivonen -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From conrad at HEP.CALTECH.EDU Wed Apr 5 22:42:53 2006 From: conrad at HEP.CALTECH.EDU (Conrad Steenberg) Date: Wed, 5 Apr 2006 13:42:53 -0700 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update In-Reply-To: <4432BFA9.8040804@osafoundation.org> References: <4432BFA9.8040804@osafoundation.org> Message-ID: <1144269773.12648.127.camel@localhost.localdomain> Hi Heikki That is indeed good news :-) I happened to need to repackage a M2Crypto for a project at CERN and decided to see if the m2c-0.15 code could be made to work with the latest version of SWIG - namely 1.3.29. The short answer is that it was almost trivial, only needing the attached patch, which comes down to a -%include +#include Apart from that, there are numerous warnings of the form _asn1.i:19: Warning(121): %name is deprecated. Use %rename instead. The code in this case in _asn.i is: %name(asn1_object_new) extern ASN1_OBJECT *ASN1_OBJECT_new( void ); Replacing the above with %rename(asn1_object_new) ASN1_OBJECT_new( void ); makes the symbols asn1_object_new and ASN1_OBJECT_new disappear from the generated __m2crypto.so :-( Do you or anybody else on the list have any idea what the correct syntax for %rename is in this case? The swig docs don't suggest anything obviously wrong with the above, afaics. See http://www.swig.org/Doc1.3/SWIGDocumentation.html Cheers Conrad On Tue, 2006-04-04 at 11:49 -0700, Heikki Toivonen wrote: > Good news: I'll be able to spend 20% of my office time on shipping > M2Crypto 0.16. > > Because of this additional time I have moved the release earlier. The > plan is to stop new development on June 1, and start doing weekly > release candidates. I expect to ship the final release by the end of June. > > To see the list of remaining bugs to be fixed etc. visit > http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto > -- Conrad Steenberg California Institute of Technology | http://conradsteenberg.info -------------- next part -------------- A non-text attachment was scrubbed... Name: m2crypto-0.15-m2crypto.patch Type: text/x-patch Size: 316 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2531 bytes Desc: not available URL: From heikki at OSAFOUNDATION.ORG Wed Apr 5 22:59:38 2006 From: heikki at OSAFOUNDATION.ORG (Heikki Toivonen) Date: Wed, 5 Apr 2006 13:59:38 -0700 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update In-Reply-To: <1144269773.12648.127.camel@localhost.localdomain> References: <4432BFA9.8040804@osafoundation.org> <1144269773.12648.127.camel@localhost.localdomain> Message-ID: <44342FBA.3030606@osafoundation.org> Conrad Steenberg wrote: > I happened to need to repackage a M2Crypto for a project at CERN and > decided to see if the m2c-0.15 code could be made to work with the > latest version of SWIG - namely 1.3.29. > > The short answer is that it was almost trivial, only needing the > attached patch, which comes down to a > > -%include > +#include Strange, we have 0.15 building at OSAF on Windows XP, Fedora Core 2 and Mac OS X without that change, using SWIG 1.3.29. > Apart from that, there are numerous warnings of the form > _asn1.i:19: Warning(121): %name is deprecated. Use %rename instead. These are all fixed on trunk. If you want that you need to pull the code with svn. There are some new warnings from SWIG 1.3.29 that I haven't yet looked at. As usual, patches accepted ;) Also, I am planning on testing with Python 2.5 (alpha1 is available AFAIK), but if someone beats me to it it would be great to get a report/patches... -- Heikki Toivonen -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From conrad at HEP.CALTECH.EDU Wed Apr 5 23:22:22 2006 From: conrad at HEP.CALTECH.EDU (Conrad Steenberg) Date: Wed, 5 Apr 2006 14:22:22 -0700 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update In-Reply-To: <44342FBA.3030606@osafoundation.org> References: <4432BFA9.8040804@osafoundation.org> <1144269773.12648.127.camel@localhost.localdomain> <44342FBA.3030606@osafoundation.org> Message-ID: <1144272142.12648.131.camel@localhost.localdomain> On Wed, 2006-04-05 at 13:59 -0700, Heikki Toivonen wrote: > Conrad Steenberg wrote: > > I happened to need to repackage a M2Crypto for a project at CERN and > > decided to see if the m2c-0.15 code could be made to work with the > > latest version of SWIG - namely 1.3.29. > > > > The short answer is that it was almost trivial, only needing the > > attached patch, which comes down to a > > > > -%include > > +#include > > Strange, we have 0.15 building at OSAF on Windows XP, Fedora Core 2 and > Mac OS X without that change, using SWIG 1.3.29. Hmm, strange... > > > Apart from that, there are numerous warnings of the form > > _asn1.i:19: Warning(121): %name is deprecated. Use %rename instead. > > These are all fixed on trunk. If you want that you need to pull the code > with svn. Thanks, I'll take a look there. Unfortunately, I have to base my work on a released package, with patches as needed. Cheers Conrad > > There are some new warnings from SWIG 1.3.29 that I haven't yet looked > at. As usual, patches accepted ;) > > Also, I am planning on testing with Python 2.5 (alpha1 is available > AFAIK), but if someone beats me to it it would be great to get a > report/patches... > -- Conrad Steenberg California Institute of Technology | http://conradsteenberg.info -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2531 bytes Desc: not available URL: From michael at STROEDER.COM Fri Apr 7 18:06:07 2006 From: michael at STROEDER.COM (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Fri, 7 Apr 2006 18:06:07 +0200 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update In-Reply-To: <44342FBA.3030606@osafoundation.org> References: <4432BFA9.8040804@osafoundation.org> <1144269773.12648.127.camel@localhost.localdomain> <44342FBA.3030606@osafoundation.org> Message-ID: <44368DEF.1080908@stroeder.com> Heikki Toivonen wrote: > > Also, I am planning on testing with Python 2.5 (alpha1 is available > AFAIK), Just in case you did not know about PEP 353 yet: http://www.python.org/dev/peps/pep-0353/ See also: http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/7e55ac8f0ca175a0/69951264453fdfb2?rnum=1&_done=%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2F7e55ac8f0ca175a0%2F69951264453fdfb2%3F#doc_69951264453fdfb2 http://svn.effbot.python-hosting.com/stuff/sandbox/python/ssizecheck.py Ciao, Michael. From heikki at OSAFOUNDATION.ORG Fri Apr 7 19:47:00 2006 From: heikki at OSAFOUNDATION.ORG (Heikki Toivonen) Date: Fri, 7 Apr 2006 10:47:00 -0700 Subject: [PYTHON-CRYPTO] M2Crypto 0.16 status update In-Reply-To: <44368DEF.1080908@stroeder.com> References: <4432BFA9.8040804@osafoundation.org> <1144269773.12648.127.camel@localhost.localdomain> <44342FBA.3030606@osafoundation.org> <44368DEF.1080908@stroeder.com> Message-ID: <4436A594.4080107@osafoundation.org> Michael Str?der wrote: > Heikki Toivonen wrote: >> Also, I am planning on testing with Python 2.5 (alpha1 is available >> AFAIK), > > http://svn.effbot.python-hosting.com/stuff/sandbox/python/ssizecheck.py I knew about the changes, but not about this tool. Nice. What was not so nice was that there were a bunch of things this tool complained, see the first attachment in this bug: https://bugzilla.osafoundation.org/show_bug.cgi?id=5581 I haven't looked into this further, but if any of the issues reported by that tool are actually generated by SWIG then we need a SWIG version that can deal with the 2.5 changes. At this point I don't know if latest SWIG can do that. Anyone know? -- Heikki Toivonen -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From greg at ELECTRICRAIN.COM Mon Apr 10 09:37:34 2006 From: greg at ELECTRICRAIN.COM (Gregory P. Smith) Date: Mon, 10 Apr 2006 00:37:34 -0700 Subject: [PYTHON-CRYPTO] hashlib 20060408a - SHA224, SHA256, SHA384 and SHA512 Message-ID: <20060410073734.GD10641@zot.electricrain.com> Announcing hashlib... md5, sha1, sha224, sha256, sha384 and sha512 all in one module. It uses (but doesn't require) OpenSSL for significantly faster implementations of all algorithms. http://code.krypto.org/python/hashlib/ This is a standalone repackaging of the hashlib included with 2.5 for use on python 2.3 and 2.4. When linked with OpenSSL you can also access its additional hash algorithms but the SHA suite and MD5 are the only ones guaranteed to exist in all hashlib versions. From arno=py at CS.VU.NL Thu Apr 20 11:43:36 2006 From: arno=py at CS.VU.NL (Arno Bakker) Date: Thu, 20 Apr 2006 11:43:36 +0200 Subject: [PYTHON-CRYPTO] Building M2Crypto on Windows using Python 2.4... Message-ID: To answer my own question: ;o) The glue between program and OpenSSL 0.9.8 that is required cannot be put in the M2Crypto library. It has to be in the .exe that runs the Python program. In the normal case this is python.exe, so to use M2Crypto with that you'll need to build python yourself with the #include "/include/openssl/applink.c" added to /Modules/python.c (for python.exe) or /PC/WinMain.c (for pythonw.exe). To use py2exe, you don't need to rebuild python. In that case it is sufficient to add the include to /sources/run.c and/or /sources/run_w.c which compile to run.exe and run_w.exe that are the basis for any py2exe program.