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 multiplication.

use crate::NonZero;

/// Multiplication reduced modulo `modulus`, without the caller holding the
/// full product. Each implementation states whether it is constant time.
pub trait ModMul<Rhs = Self, Modulus = NonZero<Self>> {
    /// The type of the reduced product.
    type Output;

    /// `(self * rhs) mod modulus`. The operands need not be below `modulus`;
    /// they are reduced first.
    fn mod_mul(&self, rhs: &Rhs, modulus: &Modulus) -> Self::Output;
}