Struct jub_jub::Fr

source ·
pub struct Fr(pub [u64; 4]);
Expand description

Bls12 381 curve scalar field

Tuple Fields§

§0: [u64; 4]

Implementations§

source§

impl Fr

source

pub const fn to_mont_form(val: [u64; 4]) -> Fr

source

pub const fn inner(&self) -> [u64; 4]

source

pub fn from_hex(hex: &str) -> Result<Fr, Error>

source

pub fn to_costomized_repr(self) -> Vec<u8>

source

pub fn is_odd(self) -> bool

source

pub fn pow_vartime(&self, by: &[u64; 4]) -> Fr

source

pub fn sqrt(&self) -> Option<Fr>

source§

impl Fr

source

pub const fn zero() -> Fr

source

pub const fn one() -> Fr

Trait Implementations§

source§

impl<'a, 'b> Add<&'b Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'b Fr) -> Fr

Performs the + operation. Read more
source§

impl<'b> Add<&'b Fr> for Fr

§

type Output = Fr

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'b Fr) -> Fr

Performs the + operation. Read more
source§

impl<'a> Add<Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the + operator.
source§

fn add(self, rhs: Fr) -> Fr

Performs the + operation. Read more
source§

impl Add for Fr

§

type Output = Fr

The resulting type after applying the + operator.
source§

fn add(self, rhs: Fr) -> Fr

Performs the + operation. Read more
source§

impl<'b> AddAssign<&'b Fr> for Fr

source§

fn add_assign(&mut self, rhs: &'b Fr)

Performs the += operation. Read more
source§

impl AddAssign for Fr

source§

fn add_assign(&mut self, rhs: Fr)

Performs the += operation. Read more
source§

impl<'a, 'b> BitAnd<&'b Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &'b Fr) -> Fr

Performs the & operation. Read more
source§

impl BitAnd for Fr

§

type Output = Fr

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Fr) -> Fr

Performs the & operation. Read more
source§

impl<'a, 'b> BitXor<&'b Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &'b Fr) -> Fr

Performs the ^ operation. Read more
source§

impl BitXor for Fr

§

type Output = Fr

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Fr) -> Fr

Performs the ^ operation. Read more
source§

impl Clone for Fr

source§

fn clone(&self) -> Fr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Fr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Decode for Fr

source§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Fr, Error>
where __CodecInputEdqy: Input,

Attempt to deserialise the value from input.
source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
source§

impl Default for Fr

source§

fn default() -> Fr

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Fr

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<Fr, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Div for Fr

§

type Output = Fr

The resulting type after applying the / operator.
source§

fn div(self, rhs: Fr) -> Fr

Performs the / operation. Read more
source§

impl DivAssign for Fr

source§

fn div_assign(&mut self, rhs: Fr)

Performs the /= operation. Read more
source§

impl Encode for Fr

source§

fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
where __CodecOutputEdqy: Output + ?Sized,

Convert self to a slice and append it to the destination.
source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
source§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
source§

impl FftField for Fr

source§

const S: usize = 32usize

source§

const ROOT_OF_UNITY: Fr = ROOT_OF_UNITY

source§

const MULTIPLICATIVE_GENERATOR: Fr = MULTIPLICATIVE_GENERATOR

source§

fn pow(self, val: u64) -> Fr

source§

fn pow_of_2(by: u64) -> Fr

source§

fn divn(&mut self, n: u32)

source§

fn from_bytes_wide(bytes: &[u8; 64]) -> Fr

source§

fn from_hash(hash: &[u8; 64]) -> Fr

source§

fn to_raw_bytes(&self) -> [u8; 32]

source§

fn reduce(&self) -> Fr

source§

fn is_even(&self) -> bool

source§

fn mod_2_pow_k(&self, k: u8) -> u8

source§

fn mods_2_pow_k(&self, w: u8) -> i8

source§

impl From<[u64; 4]> for Fr

source§

fn from(val: [u64; 4]) -> Fr

Converts to this type from the input type.
source§

impl From<Fp> for Fr

source§

fn from(scalar: Fp) -> Fr

Converts to this type from the input type.
source§

impl From<Fq> for Fr

source§

fn from(_: Fq) -> Fr

Converts to this type from the input type.
source§

impl From<Fq2> for Fr

source§

fn from(_: Fq2) -> Fr

Converts to this type from the input type.
source§

impl From<Fr> for Fp

source§

fn from(scalar: Fr) -> Fp

Converts to this type from the input type.
source§

impl From<u64> for Fr

source§

fn from(val: u64) -> Fr

Converts to this type from the input type.
source§

impl Group for Fr

source§

impl<'a, 'b> Mul<&'b Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b Fr) -> Fr

Performs the * operation. Read more
source§

impl<'b> Mul<&'b Fr> for Fr

§

type Output = Fr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b Fr) -> Fr

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b G1Affine> for &'a Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b G1Affine) -> <&'a Fr as Mul<&'b G1Affine>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a G1Affine> for Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a G1Affine) -> <Fr as Mul<&'a G1Affine>>::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b G1Projective> for &'a Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b G1Projective) -> <&'a Fr as Mul<&'b G1Projective>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a G1Projective> for Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a G1Projective) -> <Fr as Mul<&'a G1Projective>>::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b G2Affine> for &'a Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b G2Affine) -> <&'a Fr as Mul<&'b G2Affine>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a G2Affine> for Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a G2Affine) -> <Fr as Mul<&'a G2Affine>>::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b G2Projective> for &'a Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b G2Projective) -> <&'a Fr as Mul<&'b G2Projective>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a G2Projective> for Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a G2Projective) -> <Fr as Mul<&'a G2Projective>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fr) -> Fr

Performs the * operation. Read more
source§

impl<'a> Mul<G1Affine> for &'a Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G1Affine) -> <&'a Fr as Mul<G1Affine>>::Output

Performs the * operation. Read more
source§

impl Mul<G1Affine> for Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G1Affine) -> <Fr as Mul<G1Affine>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<G1Projective> for &'a Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G1Projective) -> <&'a Fr as Mul<G1Projective>>::Output

Performs the * operation. Read more
source§

impl Mul<G1Projective> for Fr

§

type Output = G1Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G1Projective) -> <Fr as Mul<G1Projective>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<G2Affine> for &'a Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G2Affine) -> <&'a Fr as Mul<G2Affine>>::Output

Performs the * operation. Read more
source§

impl Mul<G2Affine> for Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G2Affine) -> <Fr as Mul<G2Affine>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<G2Projective> for &'a Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G2Projective) -> <&'a Fr as Mul<G2Projective>>::Output

Performs the * operation. Read more
source§

impl Mul<G2Projective> for Fr

§

type Output = G2Projective

The resulting type after applying the * operator.
source§

fn mul(self, rhs: G2Projective) -> <Fr as Mul<G2Projective>>::Output

Performs the * operation. Read more
source§

impl Mul for Fr

§

type Output = Fr

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fr) -> Fr

Performs the * operation. Read more
source§

impl<'b> MulAssign<&'b Fr> for Fr

source§

fn mul_assign(&mut self, rhs: &'b Fr)

Performs the *= operation. Read more
source§

impl MulAssign for Fr

source§

fn mul_assign(&mut self, rhs: Fr)

Performs the *= operation. Read more
source§

impl<'a> Neg for &'a Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn neg(self) -> Fr

Performs the unary - operation. Read more
source§

impl Neg for Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn neg(self) -> Fr

Performs the unary - operation. Read more
source§

impl Ord for Fr

source§

fn cmp(&self, other: &Fr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Fr

source§

fn eq(&self, other: &Fr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Fr

source§

fn partial_cmp(&self, other: &Fr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &Fr) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &Fr) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

fn gt(&self, other: &Fr) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

fn ge(&self, other: &Fr) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PrimeField for Fr

source§

const MODULUS: Fr = _

source§

const INV: u64 = 18_446_744_069_414_584_319u64

source§

fn is_zero(self) -> bool

source§

fn to_bits(self) -> Vec<u8>

source§

fn to_nafs(self) -> Vec<Naf>

source§

fn double(self) -> Fr

source§

fn square(self) -> Fr

source§

fn double_assign(&mut self)

source§

fn square_assign(&mut self)

source§

impl<T> Product<T> for Fr
where T: Borrow<Fr>,

source§

fn product<I>(iter: I) -> Fr
where I: Iterator<Item = T>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Ring for Fr

source§

impl Serialize for Fr

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SigUtils<32> for Fr

source§

fn to_bytes(self) -> [u8; 32]

source§

fn from_bytes(bytes: [u8; 32]) -> Option<Fr>

source§

const LENGTH: usize = L

source§

impl<'a, 'b> Sub<&'b Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'b Fr) -> Fr

Performs the - operation. Read more
source§

impl<'b> Sub<&'b Fr> for Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'b Fr) -> Fr

Performs the - operation. Read more
source§

impl<'a> Sub<Fr> for &'a Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Fr) -> Fr

Performs the - operation. Read more
source§

impl Sub for Fr

§

type Output = Fr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Fr) -> Fr

Performs the - operation. Read more
source§

impl<'b> SubAssign<&'b Fr> for Fr

source§

fn sub_assign(&mut self, rhs: &'b Fr)

Performs the -= operation. Read more
source§

impl SubAssign for Fr

source§

fn sub_assign(&mut self, rhs: Fr)

Performs the -= operation. Read more
source§

impl<T> Sum<T> for Fr
where T: Borrow<Fr>,

source§

fn sum<I>(iter: I) -> Fr
where I: Iterator<Item = T>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Basic for Fr

source§

impl Copy for Fr

source§

impl EncodeLike for Fr

source§

impl Eq for Fr

source§

impl Field for Fr

source§

impl ParallelCmp for Fr

source§

impl ParityCmp for Fr

source§

impl RefOps for Fr

Auto Trait Implementations§

§

impl RefUnwindSafe for Fr

§

impl Send for Fr

§

impl Sync for Fr

§

impl Unpin for Fr

§

impl UnwindSafe for Fr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DecodeAll for T
where T: Decode,

source§

fn decode_all(input: &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

impl<T> DecodeLimit for T
where T: Decode,

source§

fn decode_all_with_depth_limit(limit: u32, input: &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

fn decode_and_advance_with_depth_limit<I>( limit: u32, input: &mut I ) -> Result<T, Error>
where I: Input,

Decode Self and advance input by the number of bytes consumed. Read more
source§

fn decode_with_depth_limit(limit: u32, input: &[u8]) -> Result<T, Error>

Decode Self with the given maximum recursion depth. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> KeyedVec for T
where T: Codec,

source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<S> Codec for S
where S: Decode + Encode,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

source§

impl<T> EncodeLike<&T> for T
where T: Encode,

source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

source§

impl<'a, T> EncodeLike<Cow<'a, T>> for T
where T: ToOwned + Encode,

source§

impl<S> FullCodec for S
where S: Decode + FullEncode,

source§

impl<S> FullEncode for S
where S: Encode + EncodeLike,