Questions about mpn_powm

Marco Bodrato bodrato at mail.dm.unipi.it
Sat Apr 13 09:46:30 UTC 2019


Ciao,

Il Sab, 13 Aprile 2019 7:08 am, ? ?? ha scritto:
> Hello, I am a student developing a library for modular arithmetic, and
> find out that your function “mpn_powm” uses REDC reduction and sliding
> window algorithm, so does mine, but your function is much faster than
> mine(10 times faster for a 256-bit prime). I see your source code of
> mpn_powm, but cannot find something special. The attachment is my code,

Well, I see something special: mpn_powm uses the other mpn_ primitives :-)
You code does not.

> which is much shorter, with a correct output. I wonder how you make it so
> fast, thanks!

Shorter code does not always mean faster code (mini-gmp is far smaller but
surely slower than GMP !-)
I'd suggest you to use the GMP library and build your own library on top
of it.


Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the gmp-discuss mailing list