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

use crate::NonZero;

/// Addition reduced modulo `modulus`. Each implementation states whether
/// it is constant time.
pub trait ModAdd<Rhs = Self, Modulus = NonZero<Self>> {
    /// The type of the reduced sum.
    type Output;

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