Cryptography in C and C++

Team-Fly

B.9 Number-Theoretic Member Functions

const unsigned int ld (void) const;

return ⌊log2(a)⌋

const int iseven (void) const;

test a for divisibility by 2: true if a even

const int isodd (void) const;

test a for divisibility by 2: true if a odd

const LINT issqr (void) const;

test a for being square

const int isprime (void) const;

test a for primality

const LINT gcd (const LINT& b);

return gcd of a and b

const LINT xgcd (const LINT& b, LINT& u, int& sign_u, LINT& v, int& sign_v) const;

extended Euclidean algorithm with return of gcd of a and b, u and v contain the absolute values of the factors of the linear combination g = sign_u*u*a + sign_v*v*b

const LINT inv (const LINT& b) const;

return the multiplicative inverse of a mod b

const LINT lcm (const LINT& b) const;

return the least common multiple of a and b

const int jacobi (const LINT& b) const;

return the Jacobi symbol ()

const LINT root (void) const;

return the integer part of the square root of a

const LINT root (const LINT& p) const;

return the square root of a modulo an odd prime p

const LINT root (const LINT& p, const LINT& q) const;

return the square root of a modulo p*q, where p and q are odd primes

const int twofact (LINT& odd) const;

return the even part of a, odd contains the odd part of a

const LINT chinrem (const LINT& m, const LINT& b, const LINT& n) const;

return a solution x of the system of simultaneous congruences x ≡ a mod m and x ≡ b mod n, if a solution exists


Team-Fly

Категории