Trait Reduce
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]>
type Bytes: AsRef<[u8]>
Bytes used as input to Reduce::reduce_bytes.
Required Methods§
fn reduce(n: Uint) -> Self
fn reduce(n: Uint) -> Self
Perform a modular reduction, returning a field element.
fn reduce_bytes(bytes: &Self::Bytes) -> Self
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::k256::Scalar
type Bytes = GenericArray<u8, <Secp256k1 as Curve>::FieldBytesSize>
§impl Reduce<Uint<crypto_bigint::::uint::U256::{constant#0}>> for airbender_crypto::p256::Scalar
impl Reduce<Uint<crypto_bigint::::uint::U256::{constant#0}>> for airbender_crypto::p256::Scalar
type Bytes = GenericArray<u8, <NistP256 as Curve>::FieldBytesSize>
§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.
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.