Discussion:
[gui-dev] Re: Faster SHA1 and Tiger MessageDigestSPI's (version 1.11)
Roger Kapsi
2004-06-30 11:50:51 UTC
Permalink
Hi

I'm currently experimenting with Philippe's SHA1 code and NIO Buffers
with the ability to access memory directly (well, lets say I'll start
the experiments at the end of next week when the exams are over :))

But as the first step I've already prepared the computeBlock() for the
C transition with some surprising results!

What I did is to change blocks like...

d += ((e << 5) | (e >>> 27)) + 0x5a827999 // K16
+ ((a & ((b = (b << 30) | (b >>> 2)) ^ c)) ^ c) // Ch(a,b,c)
+ (i00 = ((i00 ^= i02 ^ i08 ^ i13) << 1) | (i00 >>> 31)); // W16

... to ...

b = (b << 30) | (b >>> 2);
i00 ^= i02 ^ i08 ^ i13;
i00 = (i00 << 1) | (i00 >>> 31);
d += ((e << 5) | (e >>> 27)) + 0x5a827999 // K16
+ ((a & (b ^ c)) ^ c) // Ch(a,b,c)
+ (i00); // W16


And here are the results:

- G3 500MHz: the hash rate drops from 17MB/s to 16MB/s
- G4 450MHz: the hash rate drops from 16MB/s to 15MB/s
- G5 2GHz: the hash rate rose from 75MB/s to 85MB/s! =)

I'm wondering now if the latest and greatest P4/Athlon systems can
benefit from this as well? Oh, and you may try this version on
10.2/Java 1.4.1 to check if it's a workaround for the wrong hash
computation problem...

Cheers!
Roger
Philippe VERDY
2004-06-30 14:49:34 UTC
Permalink
Message du 30/06/04 16:33
De : "Roger Kapsi"
Objet : [gui-dev] Re: Faster SHA1 and Tiger MessageDigestSPI's (version 1.11)
[ (pas de nom de fichier) (0.1 Ko) ]
I suppose, Roger, that you forgot to include your message before sending it, or you wanted to reply to another mail and clicked Send instead of Close...

The most current versions of SHA1, MD5 and Tiger digest SPIs are now listed by Sun in a RFE for some version of Java 1.5. I have also put them in a mirror at http://www.rodage.org/pub/java/

GnuCrypto is being reworked too to include my optimizations for them (however GnuCrypto uses its own IMessageDigest interface from which a standard MessageDigestSPI is added on top, if used within a standard security provider).

I had started to rework SHA-256 (and SHA-224 which is a small variant), SHA-512 (and its variant SHA-256), because they are now becoming part of the standard approved in US and Europe, and in almost all new PKI certificates for signatures. My tests on these show LOT of optimizations from the current Sun implementation which is desesperately slow...

So my SHA1 and MD5 are already competing with JNI/C implementations: my 100% pure Java version offers nearly the same performance as many C implementations when running the Server JVM or with the Client VM in batch mode, except that JNI uses more committed system memory to load external DLLs or shared libraries.

The internal JIT of Java 1.5 (code-named Tiger) is now so fast that JNI development is no more justified for something else than integration with local system components.
Loading...