[Python-Dev] SHA-256 module (original) (raw)
Trevor Perrin trevp at trevp.net
Fri Jul 2 18:21:16 CEST 2004
- Previous message: [Python-Dev] PEP 327: from_float()
- Next message: [Python-Dev] PEP 327: from_float()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 08:55 AM 7/2/2004 -0700, Gregory P. Smith wrote:
On Fri, Jul 02, 2004 at 01:54:05AM -0700, Trevor Perrin wrote: > At 03:52 PM 6/30/2004 -0700, Gregory P. Smith wrote: > [...] > >The point about SSL being included is interesting. The OpenSSL library > >provides implementations of all of the important hash algorithms (and > >uses them in order to implement ssl!). Its hashing code is much better > >optimized on various architectures than the python module ever will > >be. > > On my P4, OpenSSL SHA-1 looks around 25% faster (75 vs. 60 MB/s).
Exactly. On my pentium2 class celeron its >200% faster. A future version of openssl should include an sse2 version of sha1 thats even faster yet on modern cpus, approaching md5 speed on some cpus. (not integrated into openssl cvs as of today, but its much nicer to let the openssl project worry about that than us).
Interesting, I didn't know there was still so much speedup to be had!
I think we should start by using your base code. I'm willing to do up a patch later to have it use OpenSSL conditionally at compilation time if someone else doesn't beat me to it.
That sounds like a good way to go.
I'm still -1 on adding top level modules as I think it pollutes the top level namespace. I'm happy with separate modules if we stick them down one level underneath a hashes or digest namespace.
for example: from digest import md5, sha1, sha256, sha224, sha384, sha512
[...]
(sha1 and md5 are included in for completeness even though their top level modules would still exist for legacy reasons)
[...]
I also don't mind the hashes.sha.new("abc", bits=224) interface that was proposed but prefer the above one as people think of them by algorithm name rather than bits (sha1 rather than 160 bit sha).
I agree with all the above - that's my preference too.
Trevor
- Previous message: [Python-Dev] PEP 327: from_float()
- Next message: [Python-Dev] PEP 327: from_float()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]