Skip to main content

IntegerExt

Trait IntegerExt 

Source
pub trait IntegerExt: Sized {
    // Required methods
    fn to_scalar<C: Curve>(&self) -> Scalar<C>;
    fn curve_order<C: Curve>() -> Self;
    fn from_rng_half_pm<R: RngCore>(rng: &mut R, range: &Self) -> Self;
    fn is_in_half_pm(&self, range: &Self) -> bool;
}

Required Methods§

Source

fn to_scalar<C: Curve>(&self) -> Scalar<C>

Embed BigInt into chosen scalar type

Source

fn curve_order<C: Curve>() -> Self

Returns prime order of curve C

Source

fn from_rng_half_pm<R: RngCore>(rng: &mut R, range: &Self) -> Self

Generates a random integer in interval [-range/2; range/2] if range is even [-(range-1)/2; (range-1)/2] if range is odd

Source

fn is_in_half_pm(&self, range: &Self) -> bool

Checks whether self is in interval [-range/2; range/2] when range is even [-(range-1)/2; (range-1)/2] when range is odd

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§