ark_r1cs_std::convert

Trait ToBytesGadget

Source
pub trait ToBytesGadget<F: Field> {
    // Required method
    fn to_bytes_le(&self) -> Result<Vec<UInt8<F>>, SynthesisError>;

    // Provided method
    fn to_non_unique_bytes_le(&self) -> Result<Vec<UInt8<F>>, SynthesisError> { ... }
}
Expand description

Specifies constraints for conversion to a little-endian byte representation of self.

Required Methods§

Source

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

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

This is the correct default for 99% of use cases.

Provided Methods§

Source

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

Outputs a possibly non-unique byte decomposition of self.

If you’re not absolutely certain that your usecase can get away with a non-canonical representation, please use self.to_bytes_le(cs) instead.

Implementations on Foreign Types§

Source§

impl<'a, F: Field, T: 'a + ToBytesGadget<F>> ToBytesGadget<F> for &'a T

Source§

impl<F: Field> ToBytesGadget<F> for ()

Source§

impl<T: ToBytesGadget<F>, F: Field> ToBytesGadget<F> for [T]

Source§

impl<T: ToBytesGadget<F>, F: Field> ToBytesGadget<F> for Vec<T>

Source§

impl<T: ToBytesGadget<F>, F: Field, const N: usize> ToBytesGadget<F> for [T; N]

Implementors§

Source§

impl<BF, P> ToBytesGadget<<P as CubicExtConfig>::BasePrimeField> for CubicExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField>, for<'a> &'a BF: FieldOpsBounds<'a, P::BaseField, BF>, P: CubicExtVarConfig<BF>,

Source§

impl<BF, P> ToBytesGadget<<P as QuadExtConfig>::BasePrimeField> for QuadExtVar<BF, P>
where BF: FieldVar<P::BaseField, P::BasePrimeField>, for<'b> &'b BF: FieldOpsBounds<'b, P::BaseField, BF>, P: QuadExtVarConfig<BF>,

Source§

impl<F: PrimeField> ToBytesGadget<F> for FpVar<F>

Source§

impl<F: PrimeField> ToBytesGadget<F> for AllocatedFp<F>

Source§

impl<F: Field> ToBytesGadget<F> for Boolean<F>

Source§

impl<P, F> ToBytesGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F>

Source§

impl<P, F> ToBytesGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for AffineVar<P, F>

Source§

impl<P: Bls12Config> ToBytesGadget<<P as Bls12Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G1PreparedVar<P>

Source§

impl<P: Bls12Config> ToBytesGadget<<P as Bls12Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::bls12::G2PreparedVar<P>

Source§

impl<P: MNT4Config> ToBytesGadget<<P as MNT4Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G1PreparedVar<P>

Source§

impl<P: MNT4Config> ToBytesGadget<<P as MNT4Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt4::G2PreparedVar<P>

Source§

impl<P: MNT6Config> ToBytesGadget<<P as MNT6Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G1PreparedVar<P>

Source§

impl<P: MNT6Config> ToBytesGadget<<P as MNT6Config>::Fp> for ark_r1cs_std::groups::curves::short_weierstrass::mnt6::G2PreparedVar<P>

Source§

impl<TargetF: PrimeField, BaseF: PrimeField> ToBytesGadget<BaseF> for EmulatedFpVar<TargetF, BaseF>

Source§

impl<TargetF: PrimeField, BaseF: PrimeField> ToBytesGadget<BaseF> for AllocatedEmulatedFpVar<TargetF, BaseF>

Source§

impl<const N: usize, T: PrimUInt, ConstraintF: Field> ToBytesGadget<ConstraintF> for UInt<N, T, ConstraintF>