Struct jub_jub::Fp

source ·
pub struct Fp(/* private fields */);
Expand description

Twisted Edwards curve Jubjub base field

Implementations§

source§

impl Fp

source

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

source

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

source

pub fn reduce(&self) -> Self

source

pub fn is_even(&self) -> bool

source

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

source

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

Compute the result from Scalar (mod 2^k).

Panics

If the given k is > 32 (5 bits) as the value gets greater than the limb.

source

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

Compute the result from Scalar (mods k).

Panics

If the given k > 32 (5 bits) || k == 0 as the value gets greater than the limb.

source§

impl Fp

source

pub const fn zero() -> Self

source

pub const fn one() -> Self

Trait Implementations§

source§

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

§

type Output = Fp

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for Fp

§

type Output = Fp

The resulting type after applying the + operator.
source§

fn add(self, rhs: Fp) -> Self

Performs the + operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

impl AddAssign for Fp

source§

fn add_assign(&mut self, rhs: Fp)

Performs the += operation. Read more
source§

impl Clone for Fp

source§

fn clone(&self) -> Fp

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 Fp

source§

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

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

impl Decode for Fp

source§

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

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 Fp

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Fp

source§

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

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

impl Div for Fp

§

type Output = Fp

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl DivAssign for Fp

source§

fn div_assign(&mut self, rhs: Fp)

Performs the /= operation. Read more
source§

impl Encode for Fp

source§

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

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: FnOnce(&[u8]) -> R>(&self, f: F) -> 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 Fp

source§

const S: usize = 1usize

source§

const ROOT_OF_UNITY: Self = ROOT_OF_UNITY

source§

const MULTIPLICATIVE_GENERATOR: Self = MULTIPLICATIVE_GENERATOR

source§

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

source§

fn pow_of_2(by: u64) -> Self

source§

fn divn(&mut self, n: u32)

source§

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

source§

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

source§

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

source§

fn reduce(&self) -> Self

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 Fp

source§

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

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<Fr> for Fp

source§

fn from(scalar: Fr) -> Fp

Converts to this type from the input type.
source§

impl From<i8> for Fp

source§

fn from(val: i8) -> Fp

Converts to this type from the input type.
source§

impl From<u64> for Fp

source§

fn from(val: u64) -> Fp

Converts to this type from the input type.
source§

impl Group for Fp

§

type Scalar = Fp

source§

const ADDITIVE_GENERATOR: Self = _

source§

const ADDITIVE_IDENTITY: Self = _

source§

fn zero() -> Self

source§

fn invert(self) -> Option<Self>

source§

fn random(rand: impl RngCore) -> Self

source§

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

§

type Output = Fp

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b Fp> for &'a JubjubAffine

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b Fp) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b Fp> for &'a JubjubExtended

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b Fp) -> Self::Output

Performs the * operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<'a> Mul<&'a Fp> for JubjubAffine

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a Fp) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a Fp> for JubjubExtended

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a Fp) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b JubjubAffine> for &'a Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b JubjubAffine) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a JubjubAffine> for Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a JubjubAffine) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b> Mul<&'b JubjubExtended> for &'a Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b JubjubExtended) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a JubjubExtended> for Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a JubjubExtended) -> Self::Output

Performs the * operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<'a> Mul<Fp> for &'a JubjubAffine

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fp) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<Fp> for &'a JubjubExtended

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fp) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Fp> for JubjubAffine

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fp) -> JubjubExtended

Performs the * operation. Read more
source§

impl Mul<Fp> for JubjubExtended

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fp) -> JubjubExtended

Performs the * operation. Read more
source§

impl<'a> Mul<JubjubAffine> for &'a Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: JubjubAffine) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<JubjubAffine> for Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: JubjubAffine) -> JubjubExtended

Performs the * operation. Read more
source§

impl<'a> Mul<JubjubExtended> for &'a Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

fn mul(self, rhs: JubjubExtended) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<JubjubExtended> for Fp

§

type Output = JubjubExtended

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul for Fp

§

type Output = Fp

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Fp) -> Self

Performs the * operation. Read more
source§

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

source§

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

Performs the *= operation. Read more
source§

impl<'b> MulAssign<&'b Fp> for JubjubExtended

source§

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

Performs the *= operation. Read more
source§

impl MulAssign<Fp> for JubjubExtended

source§

fn mul_assign(&mut self, rhs: Fp)

Performs the *= operation. Read more
source§

impl MulAssign for Fp

source§

fn mul_assign(&mut self, rhs: Fp)

Performs the *= operation. Read more
source§

impl<'a> Neg for &'a Fp

§

type Output = Fp

The resulting type after applying the - operator.
source§

fn neg(self) -> Fp

Performs the unary - operation. Read more
source§

impl Neg for Fp

§

type Output = Fp

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl Ord for Fp

source§

fn cmp(&self, other: &Self) -> 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 Fp

source§

fn eq(&self, other: &Self) -> 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 Fp

source§

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

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

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

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

fn le(&self, other: &Self) -> 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: &Self) -> bool

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

fn ge(&self, other: &Self) -> 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 Fp

source§

const MODULUS: Self = _

source§

const INV: u64 = 1_991_615_062_597_996_281u64

source§

fn is_zero(self) -> bool

source§

fn to_bits(self) -> Bits

source§

fn to_nafs(self) -> Nafs

source§

fn double(self) -> Self

source§

fn square(self) -> Self

source§

fn double_assign(&mut self)

source§

fn square_assign(&mut self)

source§

impl Ring for Fp

source§

impl Serialize for Fp

source§

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

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

impl SigUtils<32> for Fp

source§

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

source§

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

source§

const LENGTH: usize = L

source§

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

§

type Output = Fp

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

§

type Output = Fp

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub for Fp

§

type Output = Fp

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Fp) -> Self

Performs the - operation. Read more
source§

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

source§

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

Performs the -= operation. Read more
source§

impl SubAssign for Fp

source§

fn sub_assign(&mut self, rhs: Fp)

Performs the -= operation. Read more
source§

impl Basic for Fp

source§

impl Copy for Fp

source§

impl EncodeLike for Fp

source§

impl Eq for Fp

source§

impl Field for Fp

source§

impl ParallelCmp for Fp

source§

impl ParityCmp for Fp

source§

impl RefOps for Fp

Auto Trait Implementations§

§

impl RefUnwindSafe for Fp

§

impl Send for Fp

§

impl Sync for Fp

§

impl Unpin for Fp

§

impl UnwindSafe for Fp

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,