diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-01 10:55:20 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-01 10:55:20 +0100 |
| commit | 32b87c5979a0e70994e4db65415ec0a2349c5618 (patch) | |
| tree | a366f6c46762f349ce8b96439a35ac944021055b /man/zptest.3 | |
| parent | Add a number of man pages (diff) | |
| download | libzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.gz libzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.bz2 libzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.xz | |
Add more man pages
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man/zptest.3')
| -rw-r--r-- | man/zptest.3 | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/man/zptest.3 b/man/zptest.3 new file mode 100644 index 0000000..404b66e --- /dev/null +++ b/man/zptest.3 @@ -0,0 +1,69 @@ +.TH ZPTEST 3 libzahl +.SH NAME +zptest - Test the primality of a big integer +.SH SYNOPSIS +.nf +#include <zahl.h> + +enum zprimality zptest(z_t \fIwitness\fP, z_t \fIquestioned\fP, z_t \fItries\fP); +.fi +.SH DESCRIPTION +.B zptest +tests whether +.I questioned +is a prime number. This is implemented using the +Miller–Rabin primality test. +.P +If +.I questioned +is determined to be a composite, the witness if its +compositeness is stored into +.I witness +unless +.I witness +is +.BR 0 . +.BR zgcd (3) +can be used on +.I questioned +and +.I witness +to extract a factor of +.IR questioned . +This factor can be either composite, prime, or 1. +.P +The risk that a composite number is determined to be +a probably prime is +.IR (1-4↑-tries) . +.SH RETURN VALUE +This function will either return: +.TP +.B NONPRIME +.I questioned +is certainly a composite number. +.TP +.B PROBABLY_PRIME +.I questioned +is probably a prime number. +.TP +.B PRIME +.I questioned +is certainly a prime number. +.SH NOTES +If +.I questioned +is less than two +.I questioned +is copied into +.P +Increasing +.I tries +only reduces the chance that +.B PROBABLY_PRIME +is returned. It cannot increase +the chance that +.B PRIME +is returned. +.IR witness . +.SH SEE ALSO +.BR zgcd (3) |
