libzahl

big integer library
git clone git://git.suckless.org/libzahl
Log | Files | Refs | README | LICENSE

zmodpow.3 (874B)


      1 .TH ZMODPOW 3 libzahl
      2 .SH NAME
      3 zmodpow - Calculate a modular power of a big integer
      4 .SH SYNOPSIS
      5 .nf
      6 #include <zahl.h>
      7 
      8 void zmodpow(z_t \fIpower\fP, z_t \fIbase\fP, z_t \fIexponent\fP, z_t \fImodulator\fP);
      9 .fi
     10 .SH DESCRIPTION
     11 .B zmodpow
     12 calculates the
     13 .IR exponent :th
     14 power of a
     15 .IR base ,
     16 modulus a
     17 .IR modulator ,
     18 and stores the result in
     19 .IR power .
     20 That is,
     21 .I power
     22 gets
     23 .RI ( base
     24     25 .IR exponent )
     26 Mod
     27 .IR modulator .
     28 .P
     29 It is safe to call
     30 .B zmodpow
     31 with non-unique parameters.
     32 .P
     33 See
     34 .BR zmod (3)
     35 for details on modulation.
     36 .SH RATIONALE
     37 It is possible to calculate the modular power
     38 with a faster algorithm than calculating the
     39 power and than the modulus of that power.
     40 .SH SEE ALSO
     41 .BR zmodpowu (3),
     42 .BR zmodsqr (3),
     43 .BR zmodmul (3),
     44 .BR zsqr (3),
     45 .BR zstr (3),
     46 .BR zadd (3),
     47 .BR zsub (3),
     48 .BR zmul (3),
     49 .BR zdiv (3),
     50 .BR zmod (3),
     51 .BR zneg (3),
     52 .BR zabs (3)