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

    // Required methods
    fn reduce(n: Uint) -> Self;
    fn reduce_bytes(bytes: &Self::Bytes) -> Self;
}
Available on crate feature arithmetic only.
Expand description

Modular reduction.

Required Associated Types§

source

type Bytes: AsRef<[u8]>

Bytes used as input to Reduce::reduce_bytes.

Required Methods§

source

fn reduce(n: Uint) -> Self

Perform a modular reduction, returning a field element.

source

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

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C, I> Reduce<I> for NonZeroScalar<C>where C: CurveArithmetic, I: Integer + ArrayEncoding, Scalar<C>: 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