Class Montgomery64

Class Documentation

class Montgomery64

the arithmetic modulo an odd n of 64 bits in Montgomery form, x R mod n with R = 2^64; the numbers in the form are below n

Public Functions

explicit constexpr Montgomery64(U64 n)

the arithmetic modulo n, with one division of 128 bits for R^2 mod n

Pre:

n is odd

inline constexpr U64 modulus(void) const
constexpr U64 to(U64 x) const

x R mod n

inline constexpr U64 from(U64 x) const

x R^-1 mod n, the number whose form is x

Pre:

x < n

inline constexpr U64 one(void) const

R mod n, the form of 1.

constexpr U64 mul(U64 a, U64 b) const

a b R^-1 mod n, the form of the product of the numbers of the forms a and b

Pre:

a < n and b < n

constexpr U64 pow(U64 x, U64 v) const

the form of x^v, x a form

Pre:

x < n