Next: , Previous: , Up: MPI library   [Contents][Index]


12.4 Calculations

Basic arithmetic operations:

Function: void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v)

w = u + v.

Function: void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v)

w = u + v. Note that v is an unsigned integer.

Function: void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m)

w = u + v \bmod m.

Function: void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v)

w = u - v.

Function: void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v)

w = u - v. v is an unsigned integer.

Function: void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m)

w = u - v \bmod m.

Function: void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v)

w = u * v.

Function: void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v)

w = u * v. v is an unsigned integer.

Function: void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m)

w = u * v \bmod m.

Function: void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long e)

w = u * 2^e.

Function: void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor, int round)

q = dividend / divisor, r = dividend \bmod divisor. q and r may be passed as NULL. round is either negative for floored division (rounds towards the next lower integer) or zero for truncated division (rounds towards zero).

Function: void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor)

r = dividend \bmod divisor.

Function: void gcry_mpi_powm (gcry_mpi_t w, const gcry_mpi_t b, const gcry_mpi_t e, const gcry_mpi_t m)

w = b^e \bmod m.

Function: int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b)

Set g to the greatest common divisor of a and b. Return true if g is 1.

Function: int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m)

Set x to the multiplicative inverse of a \bmod m. Return true if the inverse exists.


Next: , Previous: , Up: MPI library   [Contents][Index]