DoxigAlpha

computeRR

Function parameters

Parameters

#
self:*Self

An unsigned big integer with a fixed maximum size (`max_bits`), suitable for cryptographic operations.

Functions

#
Uint
An unsigned big integer with a fixed maximum size (`max_bits`), suitable for cryptographic operations.
Modulus
A modulus, defining a finite field.

Error sets in this namespace

Error Sets

#
OverflowError
Value is too large for the destination.
InvalidModulusError
Invalid modulus.
NullExponentError
Exponentiation with a null exponent.
FieldElementError
Invalid field element for the given modulus.
RepresentationError
Invalid representation (Montgomery vs non-Montgomery domain.)
Error
The set of all possible errors `std.crypto.ff` functions can return.

Source

Implementation

#
fn computeRR(self: *Self) void {
    self.rr = self.zero;
    const n = self.rr.limbs_count();
    self.rr.v.limbs()[n - 1] = 1;
    for ((n - 1)..(2 * n)) |_| {
        self.shiftIn(&self.rr, 0);
    }
    self.shrink(&self.rr) catch unreachable;
}