tc_modular 0.1.0

Modular arithmetic and Montgomery forms for cryptography over the integers of tc_bigint, constant time over the fixed-width and padded ones.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Modular exponentiation.

use crate::NonZero;

/// Exponentiation reduced modulo `modulus`. Each implementation states
/// whether it is constant time, and in which of its operands.
pub trait ModPow<Exponent = Self, Modulus = NonZero<Self>> {
    /// The type of the reduced power.
    type Output;

    /// `self` to the power `exponent`, mod `modulus`. `self` need not be below
    /// `modulus`; it is reduced first.
    fn mod_pow(&self, exponent: &Exponent, modulus: &Modulus) -> Self::Output;
}