.Dd April 14, 1997 .Dt BIGPRIME 1 .Os NetBSD 1.2BETA .Sh NAME .Nm bigprime .Nd big prime generator .Sh SYNOPSIS .Nm .Op Fl i .Op Fl I .Op Fl x .Op Fl b Ns Ar N .Op Fl t Ns Ar N .Op Fl v Ns Op Cm v... .Ar nbits .Sh DESCRIPTION .Nm generates a prime .Ar nbits bits long, printing it to stdout in decimal. By default, it gets the basic randomness it needs by running various system utilities, such as .Xr ps 1 and .Xr netstat 1 . If .Fl i is given, it also reads its standard input to EOF and uses that as additional randomness. If .Fl I is given, standard input is read and the other sources are ignored. This is emphatically not recommended; the option exists for people who have a relatively high-bandwidth source of strong random bits and don't want to (or can't) wait for the normal randomness-gathering process. .Pp Of course, for reasonably large values of .Ar nbits , it is not feasible to fully test the generated number for primality. A large number of small primes are tested against; once those are passed, a test based on Fermat's Little Theorem is done, and if that too is passed, several iterations of a probabilistic primality test are done, each iteration having probability at least 3/4 of detecting a nonprime. By default, 32 such iterations are done, meaning the probability that the number output is not prime is no greater than one in 2^64; additional paranoia may be added at the cost of running time (or faster running time may be obtained at the cost of lessened checking) by specifying .Fl t , which takes an argument giving the number of iterations of the probabilistic test to do. .Pp .Fl v causes .Nm to be chatty on stderr, printing various progress messages as it does its thing. Specifying .Fl v multiple times increases the level of chattiness. .Pp By default, the generated number is output in decimal. Specifying .Fl b Ns Ar N produces output in base .Ar N instead; .Fl x is an abbreviation for .Fl b Ns Ar 16 . .Sh BUGS Feeding large amounts of data to the .Fl i option tends to be computationally expensive (but for some applications may be worth it). .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .