Trait snarkvm_wasm::traits::curves::GroupGadget[][src]

pub trait GroupGadget<G, F>: AllocGadget<G, F> + EqGadget<F> + NEqGadget<F> + CondSelectGadget<F> + ToBitsGadget<F> + ToBytesGadget<F> + Clone + Debug where
    G: Group,
    F: Field
{ type Value: Debug; type Variable; pub fn get_value(&self) -> Option<Self::Value>;
pub fn get_variable(&self) -> Self::Variable;
pub fn zero<CS>(cs: CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn add<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn add_constant<CS>(
        &self,
        cs: CS,
        other: &G
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn negate<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn cost_of_add() -> usize;
pub fn cost_of_double() -> usize; pub fn sub<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn sub_constant<CS>(
        &self,
        cs: CS,
        other: &G
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn mul_bits<CS>(
        &self,
        cs: CS,
        result: &Self,
        bits: impl Iterator<Item = Boolean>
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn precomputed_base_scalar_mul<'a, CS, I, B>(
        &mut self,
        cs: CS,
        scalar_bits_with_base_powers: I
    ) -> Result<(), SynthesisError>
    where
        B: Borrow<Boolean>,
        CS: ConstraintSystem<F>,
        G: 'a,
        I: Iterator<Item = (B, &'a G)>
, { ... }
pub fn precomputed_base_symmetric_scalar_mul<'a, CS, I, B>(
        &mut self,
        cs: CS,
        scalar_bits_with_base_powers: I
    ) -> Result<(), SynthesisError>
    where
        B: Borrow<Boolean>,
        CS: ConstraintSystem<F>,
        G: 'a,
        I: Iterator<Item = (B, &'a G)>
, { ... }
pub fn precomputed_base_scalar_mul_masked<'a, CS, I, B>(
        &mut self,
        CS,
        I,
        I
    ) -> Result<(), SynthesisError>
    where
        B: Borrow<Boolean>,
        CS: ConstraintSystem<F>,
        G: 'a,
        I: Iterator<Item = (B, &'a G)>
, { ... }
pub fn precomputed_base_3_bit_signed_digit_scalar_mul<CS, I, J, K, B>(
        CS,
        &[B],
        K
    ) -> Result<Self, SynthesisError>
    where
        B: Borrow<[G]>,
        CS: ConstraintSystem<F>,
        I: Borrow<[Boolean]>,
        J: Iterator<Item = I>,
        K: Iterator<Item = J>
, { ... }
pub fn precomputed_base_multiscalar_mul<'a, CS, T, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I
    ) -> Result<Self, SynthesisError>
    where
        B: Borrow<[G]>,
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F> + ?Sized,
        I: Iterator<Item = &'a T>
, { ... }
pub fn precomputed_base_symmetric_multiscalar_mul<'a, CS, T, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I
    ) -> Result<Self, SynthesisError>
    where
        B: Borrow<[G]>,
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F> + ?Sized,
        I: Iterator<Item = &'a T>
, { ... }
pub fn precomputed_base_multiscalar_mul_masked<'a, CS, T, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I,
        mask_bases: &[B],
        masks: I
    ) -> Result<Self, SynthesisError>
    where
        B: Borrow<[G]>,
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F> + ?Sized,
        I: Iterator<Item = &'a T>
, { ... } }

Associated Types

Loading content...

Required methods

pub fn get_value(&self) -> Option<Self::Value>[src]

pub fn get_variable(&self) -> Self::Variable[src]

pub fn zero<CS>(cs: CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn add<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn add_constant<CS>(
    &self,
    cs: CS,
    other: &G
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn negate<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost_of_add() -> usize[src]

pub fn cost_of_double() -> usize[src]

Loading content...

Provided methods

pub fn sub<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn sub_constant<CS>(
    &self,
    cs: CS,
    other: &G
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul_bits<CS>(
    &self,
    cs: CS,
    result: &Self,
    bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Inputs must be specified in little-endian form. If the addition law is incomplete for the identity element, result must not be the identity element.

pub fn precomputed_base_scalar_mul<'a, CS, I, B>(
    &mut self,
    cs: CS,
    scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
    B: Borrow<Boolean>,
    CS: ConstraintSystem<F>,
    G: 'a,
    I: Iterator<Item = (B, &'a G)>, 
[src]

pub fn precomputed_base_symmetric_scalar_mul<'a, CS, I, B>(
    &mut self,
    cs: CS,
    scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
    B: Borrow<Boolean>,
    CS: ConstraintSystem<F>,
    G: 'a,
    I: Iterator<Item = (B, &'a G)>, 
[src]

pub fn precomputed_base_scalar_mul_masked<'a, CS, I, B>(
    &mut self,
    CS,
    I,
    I
) -> Result<(), SynthesisError> where
    B: Borrow<Boolean>,
    CS: ConstraintSystem<F>,
    G: 'a,
    I: Iterator<Item = (B, &'a G)>, 
[src]

pub fn precomputed_base_3_bit_signed_digit_scalar_mul<CS, I, J, K, B>(
    CS,
    &[B],
    K
) -> Result<Self, SynthesisError> where
    B: Borrow<[G]>,
    CS: ConstraintSystem<F>,
    I: Borrow<[Boolean]>,
    J: Iterator<Item = I>,
    K: Iterator<Item = J>, 
[src]

pub fn precomputed_base_multiscalar_mul<'a, CS, T, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I
) -> Result<Self, SynthesisError> where
    B: Borrow<[G]>,
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F> + ?Sized,
    I: Iterator<Item = &'a T>, 
[src]

pub fn precomputed_base_symmetric_multiscalar_mul<'a, CS, T, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I
) -> Result<Self, SynthesisError> where
    B: Borrow<[G]>,
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F> + ?Sized,
    I: Iterator<Item = &'a T>, 
[src]

pub fn precomputed_base_multiscalar_mul_masked<'a, CS, T, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I,
    mask_bases: &[B],
    masks: I
) -> Result<Self, SynthesisError> where
    B: Borrow<[G]>,
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F> + ?Sized,
    I: Iterator<Item = &'a T>, 
[src]

Compute ∏((h_i^{-1} * 1[p_i = 0] + h_i * 1[p_i = 1])^{1 - m_i \xor p_i})((g_i h_i^{-1} * 1[p_i = 0] + g_i^{-1} h_i * 1[p_i = 1])^{m_i \xor p_i}) for all i, m_i being the scalars, p_i being the masks, h_i being the symmetric Pedersen bases and g_i the Pedersen bases.

Loading content...

Implementors

impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::bls12::AffineGadget<P, F, FG> where
    P: SWModelParameters,
    F: PrimeField,
    FG: FieldGadget<<P as ModelParameters>::BaseField, F>, 
[src]

type Value = GroupProjective<P>

type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)

pub fn add<CS>(
    &self,
    cs: CS,
    other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Incomplete addition: neither self nor other can be the neutral element.

pub fn add_constant<CS>(
    &self,
    cs: CS,
    other: &GroupProjective<P>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Incomplete addition: neither self nor other can be the neutral element.

impl<P, F, FG> GroupGadget<GroupAffine<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
    P: TEModelParameters,
    F: Field,
    FG: FieldGadget<<P as ModelParameters>::BaseField, F>, 
[src]

type Value = GroupAffine<P>

type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)

pub fn add<CS>(
    &self,
    cs: CS,
    other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Optimized constraints for checking Edwards point addition from ZCash developers Daira Hopwood and Sean Bowe. Requires only 6 constraints compared to 7 for the straightforward version we had earlier.

impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
    P: TEModelParameters,
    F: Field,
    FG: FieldGadget<<P as ModelParameters>::BaseField, F>, 
[src]

type Value = GroupProjective<P>

type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)

pub fn add<CS>(
    &self,
    cs: CS,
    other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Optimized constraints for checking Edwards point addition from ZCash developers Daira Hopwood and Sean Bowe. Requires only 6 constraints compared to 7 for the straightforward version we had earlier.

Loading content...