Skip to main content

F

Struct F 

Source
pub struct F { /* private fields */ }
Expand description

A scalar exponent for the Banderwagon group G: an element of the scalar field Z/r, where r is the prime group order.

Stored as a canonical little-endian integer in [0, r). The in-circuit secret is witnessed directly as its bits (F::BITS of them, enough to cover all of [0, r)), with no recomposition or canonicity constraint (see G::scalar_mul_bits): the bits simply are the exponent. A witnessed bit pattern is not itself constrained to [0, r) and so may exceed r, but that is harmless: every use feeds the bits into a group scalar multiplication, which is well-defined modulo r, so any alias of the same residue yields the same result.

Implementations§

Source§

impl F

Source

pub fn bits(&self) -> Vec<bool>

The little-endian bits of the integer, F::BITS of them (enough to represent any element of [0, r)).

Trait Implementations§

Source§

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

Source§

type Output = F

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a F> for F

Source§

fn add_assign(&mut self, rhs: &'a Self)

Performs the += operation. Read more
Source§

impl Additive for F

Source§

fn zero() -> Self

The neutral element for addition.
Source§

fn double(&mut self)

Add an element to itself. Read more
Source§

fn scale(&self, bits_le: &[u64]) -> Self

Scale this number by a positive integer. Read more
Source§

impl Clone for F

Source§

fn clone(&self) -> F

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for F

Source§

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

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

impl Default for F

Source§

fn default() -> F

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

impl Eq for F

Source§

impl Field for F

Source§

fn inv(&self) -> Self

The multiplicative inverse of an element. Read more
Source§

impl FixedSize for F

Source§

const SIZE: usize = 32

The size of the encoded value (in bytes).
Source§

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

Source§

type Output = F

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a F> for G

Source§

type Output = G

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a F> for F

Source§

fn mul_assign(&mut self, rhs: &'a Self)

Performs the *= operation. Read more
Source§

impl<'a> MulAssign<&'a F> for G

Source§

fn mul_assign(&mut self, rhs: &'a F)

Performs the *= operation. Read more
Source§

impl Multiplicative for F

Source§

fn square(&mut self)

Multiply an element with itself. Read more
Source§

impl Neg for F

Source§

type Output = F

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Object for F

Source§

impl PartialEq for F

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Random for F

Source§

fn random(rng: impl CryptoRng) -> Self

Sample an object uniformly at random.
Source§

impl Read for F

Source§

type Cfg = ()

The Cfg type parameter allows passing configuration during the read process. This is crucial for safely decoding untrusted data, for example, by providing size limits for collections or strings. Read more
Source§

fn read_cfg(buf: &mut impl Buf, _: &()) -> Result<Self, CodecError>

Reads a value from the buffer using the provided configuration cfg. Read more
Source§

impl Ring for F

Source§

fn one() -> Self

The neutral element for multiplication. Read more
Source§

fn exp(&self, bits_le: &[u64]) -> Self

Exponentiate this number by a positive integer. Read more
Source§

impl Space<F> for G

Source§

fn msm(points: &[Self], scalars: &[F], _strategy: &impl Strategy) -> Self

Calculate sum_i points[i] * scalars[i]. Read more
Source§

impl StructuralPartialEq for F

Source§

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

Source§

type Output = F

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a F> for F

Source§

fn sub_assign(&mut self, rhs: &'a Self)

Performs the -= operation. Read more
Source§

impl Write for F

Source§

fn write(&self, buf: &mut impl BufMut)

Writes the binary representation of self to the provided buffer buf. Read more
Source§

fn write_bufs(&self, buf: &mut impl BufsMut)

Writes to a BufsMut, allowing existing Bytes chunks to be appended via BufsMut::push instead of written inline. Must encode to the same format as Write::write. Defaults to Write::write.

Auto Trait Implementations§

§

impl Freeze for F

§

impl RefUnwindSafe for F

§

impl Send for F

§

impl Sync for F

§

impl Unpin for F

§

impl UnsafeUnpin for F

§

impl UnwindSafe for F

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> CodecFixed for T
where T: Codec + FixedSize,

Source§

impl<T> CodecFixedShared for T
where T: CodecFixed<Cfg = ()> + Send + Sync,

Source§

impl<T> CodecShared for T
where T: Codec + Send + Sync,

Source§

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

Source§

fn decode_cfg(buf: impl Buf, cfg: &Self::Cfg) -> Result<Self, Error>

Decodes a value from buf using cfg, ensuring the entire buffer is consumed. Read more
Source§

impl<X, T> DecodeExt<X> for T
where X: IsUnit, T: Decode<Cfg = X>,

Source§

fn decode(buf: impl Buf) -> Result<Self, Error>

Decodes a value using the default () config.
Source§

impl<T> DecodeFixed for T
where T: Read<Cfg = ()> + FixedSize,

Source§

fn decode_fixed<const N: usize>(bytes: [u8; N]) -> Result<Self, Error>

Decodes a value from a fixed-size byte array [u8; N], ensuring all bytes are consumed. Read more
Source§

impl<T> Encode for T
where T: Write + EncodeSize,

Source§

fn encode(&self) -> Bytes

Encodes self into a new Bytes buffer. Read more
Source§

fn encode_mut(&self) -> BytesMut

Encodes self into a new BytesMut buffer. Read more
Source§

impl<T> EncodeFixed for T
where T: Write + FixedSize,

Source§

fn encode_fixed<const N: usize>(&self) -> [u8; N]

Encodes self into a fixed-size byte array [u8; N]. Read more
Source§

impl<T> EncodeShared for T
where T: Encode + Send + Sync,

Source§

impl<T> EncodeSize for T
where T: FixedSize,

Source§

fn encode_size(&self) -> usize

Returns the encoded size of this value (in bytes).
Source§

fn encode_size_slice(values: &[T]) -> usize
where T: Sized,

Source§

fn encode_inline_size_slice(values: &[T]) -> usize
where T: Sized,

Source§

fn encode_inline_size(&self) -> usize

Returns the encoded size excluding bytes passed to BufsMut::push during Write::write_bufs. Used to size the working buffer for inline writes. Override alongside Write::write_bufs for types where large Bytes fields go via push; failing to do so will over-allocate.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

Source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ReadExt for T
where T: Read<Cfg = ()>,

Source§

fn read(buf: &mut impl Buf) -> Result<Self, Error>

Reads a value using the default () config.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

Source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,

Source§

impl<R> Space<R> for R

Source§

fn msm(points: &[Self], scalars: &[R], _strategy: &impl Strategy) -> Self

Calculate sum_i points[i] * scalars[i]. Read more
Source§

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

Source§

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>,

Source§

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>,

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more