pub trait Reduce<Uint>: Sizedwhere
    Uint: Integer,{
    type Bytes: AsRef<[u8]>;

    // Required methods
    fn reduce(n: Uint) -> Self;
    fn reduce_bytes(bytes: &Self::Bytes) -> Self;
}
Expand description

Modular reduction.

Required Associated Types§

type Bytes: AsRef<[u8]>

Bytes used as input to Reduce::reduce_bytes.

Required Methods§

fn reduce(n: Uint) -> Self

Perform a modular reduction, returning a field element.

fn reduce_bytes(bytes: &Self::Bytes) -> Self

Interpret the given bytes as an integer and perform a modular reduction.

Implementors§

§

impl<C, I> Reduce<I> for NonZeroScalar<C>where C: CurveArithmetic, I: Integer + ArrayEncoding, <C as CurveArithmetic>::Scalar: Reduce<I> + ReduceNonZero<I>,

Note: this is a non-zero reduction, as it’s impl’d for NonZeroScalar.

§

type Bytes = <<C as CurveArithmetic>::Scalar as Reduce<I>>::Bytes