Trait Scalar

Source
pub trait Scalar:
    Clone
    + Debug
    + Display
    + PartialEq
    + Default
    + for<'a> From<&'a str>
    + Sync
    + Send
    + One
    + Sum
    + Product
    + Sub<Output = Self>
    + Copy
    + MulAssign
    + AddAssign
    + Zero
    + for<'a> From<&'a Self>
    + for<'a> From<&'a bool>
    + for<'a> From<&'a i8>
    + for<'a> From<&'a i16>
    + for<'a> From<&'a i32>
    + for<'a> From<&'a i64>
    + for<'a> From<&'a i128>
    + for<'a> From<&'a u8>
    + for<'a> From<&'a u64>
    + TryInto<bool>
    + TryInto<u8>
    + TryInto<i8>
    + TryInto<i16>
    + TryInto<i32>
    + TryInto<i64>
    + TryInto<i128>
    + Into<[u64; 4]>
    + From<[u64; 4]>
    + From<u8>
    + Ord
    + Neg<Output = Self>
    + Zero
    + AddAssign
    + CanonicalSerialize
    + UniformRand
    + Inv<Output = Option<Self>>
    + SubAssign
    + RefInto<[u64; 4]>
    + for<'a> From<&'a String>
    + VarInt
    + From<String>
    + From<i128>
    + From<i64>
    + From<i32>
    + From<i16>
    + From<i8>
    + From<u64>
    + From<bool>
    + Into<BigInt>
    + TryFrom<BigInt, Error = ScalarConversionError> {
    const MAX_SIGNED: Self;
    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;
    const TEN: Self;
    const TWO_POW_64: Self;
    const CHALLENGE_MASK: U256;
    const MAX_BITS: u8;
    const MAX_SIGNED_U256: U256;
}
Expand description

A trait for the scalar field used in Proof of SQL.

Required Associated Constants§

Source

const MAX_SIGNED: Self

The value (p - 1) / 2. This is “mid-point” of the field - the “six” on the clock. It is the largest signed value that can be represented in the field with the natural embedding.

Source

const ZERO: Self

The 0 (additive identity) element of the field.

Source

const ONE: Self

The 1 (multiplicative identity) element of the field.

Source

const TWO: Self

1 + 1

Source

const TEN: Self

2 + 2 + 2 + 2 + 2

Source

const TWO_POW_64: Self

2^64

Source

const CHALLENGE_MASK: U256

The value to mask the challenge with to ensure it is in the field. This one less than the largest power of 2 that is less than the field modulus.

Source

const MAX_BITS: u8

The largest n such that 2^n <=p

Source

const MAX_SIGNED_U256: U256

A U256 representation of the largest signed value in the field.

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<T> Scalar for MontScalar<T>
where T: MontConfig<4>,