Module utils

Source
Expand description

Utility functions for converting between different types of field elements.

Modules§

fs
Module for reading parameters for Halo2 proving system from the file system.
halo2
Helper functions for raw halo2 operations to unify slight differences in API for halo2-axiom and halo2-pse

Traits§

BigPrimeField
Helper trait to convert to and from a BigPrimeField by converting a list of u64 digits
CurveAffineExt
ScalarField
Helper trait to represent a field element that can be converted into u64 limbs.

Functions§

bigint_to_fe
Converts an immutable reference to BigInt to a BigPrimeField.
biguint_to_fe
Converts an immutable reference to BigUint to a BigPrimeField.
bit_length
Returns the number of bits needed to represent the value of x.
compose
Computes the value of an integer by passing as input a Vec of its limb values and the bit_len (bit length) used.
decompose
Decomposes an immutable reference to a BigPrimeField element into number_of_limbs limbs of bit_len bits each and returns a Vec of BigPrimeField represented by those limbs.
decompose_bigint
Decomposes an immutable reference to a BigInt into num_limbs limbs of bit_len bits each and returns a Vec of BigPrimeField represented by those limbs.
decompose_bigint_option
Decomposes an immutable reference to a BigInt into num_limbs limbs of bit_len bits each and returns a Vec of BigPrimeField represented by those limbs wrapped in Value.
decompose_biguint
Decomposes an immutable reference to a BigUint into num_limbs limbs of bit_len bits each and returns a Vec of BigPrimeField represented by those limbs.
decompose_fe_to_u64_limbs
Decomposes an immutable reference to a ScalarField element into number_of_limbs limbs of bit_len bits each and returns a Vec of u64 represented by those limbs.
fe_to_bigint
Converts a BigPrimeField element into a BigInt element by sending fe in [0, F::modulus()) to
fe_to_biguint
Converts an immutable reference to an PrimeField element into a BigUint element.
log2_ceil
Returns the ceiling of the base 2 logarithm of x.
modulus
Returns the modulus of BigPrimeField.
power_of_two
Returns the BigPrimeField element of 2n.
value_to_option
Wraps the internal value of value in an Option. If the value is None, then the function returns None.