pub struct Montgomery<I, M>(_, _);
Expand description

A modular reducer based on Montgomery form, only supports odd modulus.

The generic type T represents the underlying integer representation for modular inverse -m^-1 mod R, and R=2^B will be used as the auxiliary modulus, where B is automatically selected based on the size of T.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Transform a normal integer into reduced form

Transform a reduced form back to normal integer

Calculate (lhs * rhs) mod m in reduced form

Calculate target^2 mod m in reduced form

Create a reducer for a modulus m

Get the modulus in original integer type

Test if the residue() == 0

Calculate (lhs + rhs) mod m in reduced form

Calculate 2*target mod m

Calculate (lhs - rhs) mod m in reduced form

Calculate -monty mod m in reduced form

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse. Read more

Calculate base ^ exp mod m in reduced form

Create a reducer for a modulus m

Get the modulus in original integer type

Test if the residue() == 0

Calculate (lhs + rhs) mod m in reduced form

Calculate 2*target mod m

Calculate (lhs - rhs) mod m in reduced form

Calculate -monty mod m in reduced form

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse. Read more

Calculate base ^ exp mod m in reduced form

Transform a normal integer into reduced form

Transform a reduced form back to normal integer

Calculate (lhs * rhs) mod m in reduced form

Calculate target^2 mod m in reduced form

Create a reducer for a modulus m

Get the modulus in original integer type

Test if the residue() == 0

Calculate (lhs + rhs) mod m in reduced form

Calculate 2*target mod m

Calculate (lhs - rhs) mod m in reduced form

Calculate -monty mod m in reduced form

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse. Read more

Calculate base ^ exp mod m in reduced form

Transform a normal integer into reduced form

Transform a reduced form back to normal integer

Calculate (lhs * rhs) mod m in reduced form

Calculate target^2 mod m in reduced form

Create a reducer for a modulus m

Get the modulus in original integer type

Test if the residue() == 0

Calculate (lhs + rhs) mod m in reduced form

Calculate 2*target mod m

Calculate (lhs - rhs) mod m in reduced form

Calculate -monty mod m in reduced form

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse. Read more

Calculate base ^ exp mod m in reduced form

Transform a normal integer into reduced form

Transform a reduced form back to normal integer

Calculate (lhs * rhs) mod m in reduced form

Calculate target^2 mod m in reduced form

Create a reducer for a modulus m

Get the modulus in original integer type

Test if the residue() == 0

Calculate (lhs + rhs) mod m in reduced form

Calculate 2*target mod m

Calculate (lhs - rhs) mod m in reduced form

Calculate -monty mod m in reduced form

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse. Read more

Calculate base ^ exp mod m in reduced form

Transform a normal integer into reduced form

Transform a reduced form back to normal integer

Calculate (lhs * rhs) mod m in reduced form

Calculate target^2 mod m in reduced form

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.