gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU Crypto] Faster hashes (SHA1, Tiger)


From: Casey Marshall
Subject: Re: [GNU Crypto] Faster hashes (SHA1, Tiger)
Date: Mon, 24 May 2004 12:21:19 -0700
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

>>>>> "Philippe" == Philippe Verdy <address@hidden> writes:

Philippe> I know that you have designed your GNU Crypto API for Java
Philippe> on your own "IMessageDigestSPI" interface instead of the
Philippe> classical "MessageDigestSPI" (you wanted to have a
Philippe> supplementary function to self-test the hashes, but these
Philippe> self-tests are really not enough to detect possible JVM bugs
Philippe> such as the one in the latests Java 1.4.1 which occurs only
Philippe> on MacOSX 10.2, but not on 10.3).

I don't think the selfTest methods ever aspired to be anything more
than a simple sanity check. That's why we have a test suite.

Not that selfTest isn't useful in finding JVM bugs. It uncovered a bug
in the way GCJ 3.3.3 compiles Tiger to MIPS machine code.

And selfTest isn't the only reason we have our own API; they provide
other information -- like the block size of the hash -- that the JCA
doesn't, and it doesn't require reflection to create instances.

Philippe> Well I have started to reimplement some hashes for
Philippe> performance, and my own version really outperforms the
Philippe> Sun/Apple JCE providers, Cryptix, jPython, and GNU Crypto...

Philippe> An example is with SHA1 (where you can compare it with the
Philippe> Sun/Apple JCE providers).  I have made it for public use in
Philippe> the Bitzi open-source project, or in LimeWire, and donated
Philippe> this code to Sun and Apple as well for their JCE.

Philippe> Look into this source and the test module:

Philippe> 
http://groups.yahoo.com/group/the_gdf/files/Proposals/Working%20Proposals/HUGE/com.bitzi.util/SHA1.java

Philippe> 
http://groups.yahoo.com/group/the_gdf/files/Proposals/Working%20Proposals/HUGE/com.bitzi.util/SHA1Test.java

Philippe> Same thing with the "Tiger" digest:

Philippe> 
http://groups.yahoo.com/group/the_gdf/files/Proposals/Working%20Proposals/HUGE/com.bitzi.util/Tiger.java

Philippe> 
http://groups.yahoo.com/group/the_gdf/files/Proposals/Working%20Proposals/HUGE/com.bitzi.util/TigerTest.java

I can't access these URLs, so I can't review them.

Philippe> You'll note how much this code is optimized to reduce all
Philippe> avoid as much as possible the accesses to class members, or
Philippe> to array indices (due to the cost of array bounds
Philippe> checking). It also avoids almost all internal copy into work
Philippe> buffers, and maximizes the reuse of local variables within
Philippe> subexpressions.

Yup. That's pretty much what I've done to optimize (somewhat) the
cipher implementations I wrote. All the other algorithms in GNU Crypto
should be analyzed and optimized for this.

(With caution, naturally. Correctness and security are more important
than speed)

-- 
Casey Marshall || address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]