caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] primality test for Big_int ?
@ 2003-09-01 12:16 Francesco Abbate
  2003-09-01 13:33 ` Xavier Leroy
  2003-09-01 13:35 ` Yamagata Yoriyuki
  0 siblings, 2 replies; 3+ messages in thread
From: Francesco Abbate @ 2003-09-01 12:16 UTC (permalink / raw)
  To: caml-list

Hello everyone,

I was implementing a modular GCD algorithm for polynomial with big_int coefficients when I've discovered that there isn't any primality test in the Nums library.

Someone can help me about this question ?

If possible I would avoid to implement a primality test by myself because
- I have to study the Rabin-Miller test
- I have to implement it in C to obtain a good speed (maybe ?)

-- 
Francesco Abbate <france.abbate@tiscalinet.it>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] primality test for Big_int ?
  2003-09-01 12:16 [Caml-list] primality test for Big_int ? Francesco Abbate
@ 2003-09-01 13:33 ` Xavier Leroy
  2003-09-01 13:35 ` Yamagata Yoriyuki
  1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 2003-09-01 13:33 UTC (permalink / raw)
  To: Francesco Abbate; +Cc: caml-list

> I was implementing a modular GCD algorithm for polynomial with
> big_int coefficients when I've discovered that there isn't any
> primality test in the Nums library.
> 
> Someone can help me about this question ?

The Cryptokit library (http://pauillac.inria.fr/~xleroy/software.html)
contains an implementation of probabilistic primality testing,
as part of RSA key generation.  

The function is called "is_pseudoprime" and it's not exported, but it
shouldn't be hard to extract it from the sources.  It operates on type
"nat", so you'll have to stick a "Big_int.nat_of_big_int" conversion
on input.

The algorithm used is that of PGP 2.6: Fermat tests against 8 small
primes.  While not as sophisticated as Miller-Rabin, this test seems
good enough for PGP, so it's good enough for me :-)

> If possible I would avoid to implement a primality test by myself because
> - I have to study the Rabin-Miller test
> - I have to implement it in C to obtain a good speed (maybe ?)

No need for C: Caml code working at the "nat" level (hand-allocated
big natural integers) is plenty fast enough.

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] primality test for Big_int ?
  2003-09-01 12:16 [Caml-list] primality test for Big_int ? Francesco Abbate
  2003-09-01 13:33 ` Xavier Leroy
@ 2003-09-01 13:35 ` Yamagata Yoriyuki
  1 sibling, 0 replies; 3+ messages in thread
From: Yamagata Yoriyuki @ 2003-09-01 13:35 UTC (permalink / raw)
  To: france.abbate; +Cc: caml-list

I think Numerix contains the Rabin-Miller test as an example.

http://pauillac.inria.fr/~quercia/

cryptokit also includes an implementation of Rabin-Miller, but IIRC, it
does not work with arbitrary integers.

http://pauillac.inria.fr/~xleroy/software.html

--
Yamagata Yoriyuki

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-01 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-01 12:16 [Caml-list] primality test for Big_int ? Francesco Abbate
2003-09-01 13:33 ` Xavier Leroy
2003-09-01 13:35 ` Yamagata Yoriyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).