elliptic_curve::ops

Trait Reduce

Source
pub trait Reduce<Uint: Integer>: Sized {
    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§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C, I> Reduce<I> for NonZeroScalar<C>

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