ark_r1cs_std::convert

Trait ToBitsGadget

Source
pub trait ToBitsGadget<F: Field> {
    // Required method
    fn to_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError>;

    // Provided methods
    fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError> { ... }
    fn to_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError> { ... }
    fn to_non_unique_bits_be(&self) -> Result<Vec<Boolean<F>>, SynthesisError> { ... }
}
Expand description

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

Required Methods§

Source

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

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

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

Provided Methods§

Source

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

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

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

Source

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

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

Source

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

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

Implementations on Foreign Types§

Source§

impl<F: Field> ToBitsGadget<F> for [Boolean<F>]

Source§

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

Outputs self.

Source§

impl<F: Field, T> ToBitsGadget<F> for Vec<T>
where [T]: ToBitsGadget<F>,

Source§

impl<const N: usize, T: PrimUInt, F: Field> ToBitsGadget<F> for [UInt<N, T, F>]

Source§

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

Interprets self as an integer, and outputs the little-endian bit-wise decomposition of that integer.

Implementors§

Source§

impl<BF, P> ToBitsGadget<<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> ToBitsGadget<<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> ToBitsGadget<F> for FpVar<F>

Source§

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



Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<const N: usize, T: PrimUInt, F: Field> ToBitsGadget<F> for UInt<N, T, F>