Skip to main content

Reduce

Trait Reduce 

pub trait Reduce<Uint>: Sized
where 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.

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§

§

impl Reduce<Uint<crypto_bigint::::uint::U256::{constant#0}>> for airbender_crypto::k256::Scalar

§

impl Reduce<Uint<crypto_bigint::::uint::U256::{constant#0}>> for airbender_crypto::p256::Scalar

§

impl Reduce<Uint<crypto_bigint::::uint::U512::{constant#0}>> for airbender_crypto::k256::Scalar

§

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

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

§

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