Struct decaf377::r1cs::element::ElementVar

source ·
pub struct ElementVar { /* private fields */ }
Expand description

Represents the R1CS equivalent of a decaf377::Element

Generally the suffix -Var will indicate that the type or variable represents in R1CS.

Implementations§

source§

impl ElementVar

source

pub fn compress_to_field(&self) -> Result<FqVar, SynthesisError>

R1CS equivalent of Element::vartime_compress_to_field

source

pub fn decompress_from_field(s_var: FqVar) -> Result<ElementVar, SynthesisError>

R1CS equivalent of Encoding::vartime_decompress

source

pub fn encode_to_curve(r_var: &FqVar) -> Result<ElementVar, SynthesisError>

Maps a field element to a decaf377 ElementVar suitable for CDH challenges.

Trait Implementations§

source§

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

§

type Output = ElementVar

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Element> for ElementVar

§

type Output = ElementVar

The resulting type after applying the + operator.
source§

fn add(self, other: Element) -> Self::Output

Performs the + operation. Read more
source§

impl Add for ElementVar

§

type Output = ElementVar

The resulting type after applying the + operator.
source§

fn add(self, other: ElementVar) -> Self::Output

Performs the + operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

impl AddAssign<Element> for ElementVar

source§

fn add_assign(&mut self, rhs: Element)

Performs the += operation. Read more
source§

impl AddAssign for ElementVar

source§

fn add_assign(&mut self, rhs: ElementVar)

Performs the += operation. Read more
source§

impl AllocVar<AffineElement, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn new_variable<T: Borrow<AffineElement>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
§

fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
§

fn new_input<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new public input of type Self in the ConstraintSystem cs.
§

fn new_witness<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new private witness of type Self in the ConstraintSystem cs.
source§

impl AllocVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn new_variable<T: Borrow<Element>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
§

fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
§

fn new_input<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new public input of type Self in the ConstraintSystem cs.
§

fn new_witness<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new private witness of type Self in the ConstraintSystem cs.
source§

impl AllocVar<Fp<MontBackend<FrConfig, 4>, 4>, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn new_variable<T: Borrow<Fq>>( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<T, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a new variable of type Self in the ConstraintSystem cs. The mode of allocation is decided by mode.
§

fn new_constant( cs: impl Into<Namespace<F>>, t: impl Borrow<V> ) -> Result<Self, SynthesisError>

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
§

fn new_input<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new public input of type Self in the ConstraintSystem cs.
§

fn new_witness<T>( cs: impl Into<Namespace<F>>, f: impl FnOnce() -> Result<T, SynthesisError> ) -> Result<Self, SynthesisError>
where T: Borrow<V>,

Allocates a new private witness of type Self in the ConstraintSystem cs.
source§

impl Clone for ElementVar

source§

fn clone(&self) -> ElementVar

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 CondSelectGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn conditionally_select( cond: &Boolean<Fq>, true_value: &Self, false_value: &Self ) -> Result<Self, SynthesisError>

If cond == &Boolean::TRUE, then this returns true_value; else, returns false_value. Read more
§

fn conditionally_select_power_of_two_vector( position: &[Boolean<ConstraintF>], values: &[Self] ) -> Result<Self, SynthesisError>

Returns an element of values whose index in represented by position. position is an array of boolean that represents an unsigned integer in big endian order. Read more
source§

impl CurveVar<Element, Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn zero() -> Self

Returns the constant F::zero(). This is the identity of the group.
source§

fn constant(other: Element) -> Self

Returns a constant with value v. Read more
source§

fn new_variable_omit_prime_order_check( cs: impl Into<Namespace<Fq>>, f: impl FnOnce() -> Result<Element, SynthesisError>, mode: AllocationMode ) -> Result<Self, SynthesisError>

Allocates a variable in the subgroup without checking if it’s in the prime-order subgroup.
source§

fn enforce_prime_order(&self) -> Result<(), SynthesisError>

Enforce that self is in the prime-order subgroup.
source§

fn double_in_place(&mut self) -> Result<(), SynthesisError>

Sets self = self + self.
source§

fn negate(&self) -> Result<Self, SynthesisError>

Coputes -self.
§

fn is_zero(&self) -> Result<Boolean<ConstraintF>, SynthesisError>

Returns a Boolean representing whether self == Self::zero().
§

fn double(&self) -> Result<Self, SynthesisError>

Computes self + self.
§

fn scalar_mul_le<'a>( &self, bits: impl Iterator<Item = &'a Boolean<ConstraintF>> ) -> Result<Self, SynthesisError>

Computes bits * self, where bits is a little-endian Boolean representation of a scalar.
§

fn precomputed_base_scalar_mul_le<'a, I, B>( &mut self, scalar_bits_with_bases: I ) -> Result<(), SynthesisError>
where I: Iterator<Item = (B, &'a C)>, B: Borrow<Boolean<ConstraintF>>, C: 'a,

Computes a I * self in place, where I is a Boolean little-endian representation of the scalar. Read more
§

fn precomputed_base_multiscalar_mul_le<'a, T, I, B>( bases: &[B], scalars: I ) -> Result<Self, SynthesisError>
where T: 'a + ToBitsGadget<ConstraintF> + ?Sized, I: Iterator<Item = &'a T>, B: Borrow<[C]>,

Computes Σⱼ(scalarⱼ * baseⱼ) for all j, where scalarⱼ is a Boolean little-endian representation of the j-th scalar.
source§

impl Debug for ElementVar

source§

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

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

impl EqGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn is_eq(&self, other: &Self) -> Result<Boolean<Fq>, SynthesisError>

Output a Boolean value representing whether self.value() == other.value().
source§

fn conditional_enforce_equal( &self, other: &Self, should_enforce: &Boolean<Fq> ) -> Result<(), SynthesisError>

If should_enforce == true, enforce that self and other are equal; else, enforce a vacuously true statement. Read more
source§

fn conditional_enforce_not_equal( &self, other: &Self, should_enforce: &Boolean<Fq> ) -> Result<(), SynthesisError>

If should_enforce == true, enforce that self and other are not equal; else, enforce a vacuously true statement. Read more
§

fn is_neq(&self, other: &Self) -> Result<Boolean<F>, SynthesisError>

Output a Boolean value representing whether self.value() != other.value(). Read more
§

fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>

Enforce that self and other are equal. Read more
§

fn enforce_not_equal(&self, other: &Self) -> Result<(), SynthesisError>

Enforce that self and other are not equal. Read more
source§

impl R1CSVar<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

§

type Value = Element

The type of the “native” value that Self represents in the constraint system.
source§

fn cs(&self) -> ConstraintSystemRef<Fq>

Returns the underlying ConstraintSystemRef. Read more
source§

fn value(&self) -> Result<Self::Value, SynthesisError>

Returns the value that is assigned to self in the underlying ConstraintSystem.
§

fn is_constant(&self) -> bool

Returns true if self is a circuit-generation-time constant.
source§

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

§

type Output = ElementVar

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<Element> for ElementVar

§

type Output = ElementVar

The resulting type after applying the - operator.
source§

fn sub(self, other: Element) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for ElementVar

§

type Output = ElementVar

The resulting type after applying the - operator.
source§

fn sub(self, other: ElementVar) -> Self::Output

Performs the - operation. Read more
source§

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

source§

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

Performs the -= operation. Read more
source§

impl SubAssign<Element> for ElementVar

source§

fn sub_assign(&mut self, rhs: Element)

Performs the -= operation. Read more
source§

impl SubAssign for ElementVar

source§

fn sub_assign(&mut self, rhs: ElementVar)

Performs the -= operation. Read more
source§

impl ToBitsGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn to_bits_le(&self) -> Result<Vec<Boolean<Fq>>, SynthesisError>

Outputs the canonical little-endian bit-wise representation of self. Read more
§

fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs a possibly non-unique little-endian bit-wise representation of self. Read more
§

fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs the canonical big-endian bit-wise representation of self.
§

fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError>

Outputs a possibly non-unique big-endian bit-wise representation of self.
source§

impl ToBytesGadget<Fp<MontBackend<FrConfig, 4>, 4>> for ElementVar

source§

fn to_bytes(&self) -> Result<Vec<UInt8<Fq>>, SynthesisError>

Outputs a canonical, little-endian, byte decomposition of self. Read more
§

fn to_non_unique_bytes(&self) -> Result<Vec<UInt8<F>>, SynthesisError>

Outputs a possibly non-unique byte decomposition of self. Read more
source§

impl<'a> GroupOpsBounds<'a, Element, ElementVar> for ElementVar

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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