[Haskell-cafe] ANN: crypto-pubkey: all your public key crypto algorithms belong to us.

Daniel Fischer daniel.is.fischer at googlemail.com
Mon Jan 14 13:49:44 CET 2013


On Monday 14 January 2013, 12:36:22, Vincent Hanquez wrote:
> On Sat, Jan 12, 2013 at 02:12:44PM +0100, Ertugrul Söylemez wrote:
> > > I've spend some good chunk of time adding KATs and tests,
> > > documentation, and making sure the performance was ahead of other
> > > haskell implementations.
> > 
> > I suggest looking at Daniel Fischer's arithmoi [1] library, which
> > implements very fast Integer operations and should provide most
> > functionality needed.  However, beware of timing attacks.
> 
> Very cool library and very similar to what crypto-numbers provides albeit
> less sophisticated.

I see you're doing a lot of x `shiftR` 1 with Integers. That's pretty bad for 
performance (at least for integer-gmp, might be not for integer-simple or 
implementations other than GHC [last I looked, JHC didn't have arbitrary 
precision Integers and used 64-bit ones, so it'd be fast there]).

> I wished I knew about it before implementing the
> same(ish) functions.
> 
> One caveat of the library is the dependence on integer-gmp.

It was meant to be fast, so exploiting the internal representation of Integers 
in some places was the way to go. I intend to make it portable, but so far am 
too good at procrastinating.  (Making it portable without losing too much 
performance is nontrivial in some places, that contributes.)

Getting a request would make it happen sooner.

> 
> > Also for the particular purpose of generating safe primes I have written
> > a blazingly fast implementation that uses intelligent sieving and finds
> > even large primes (>= 4096 bits) within seconds or minutes.  It's on
> > hpaste [2].  I might turn this into a library at some point.
> 
> Seconds or minutes ? that's very different :-)
> But in any case, it would be a nice addition i think.
> 
> My safe prime generation function is probably the most naive possible.



More information about the Haskell-Cafe mailing list