Trait halo2_base::utils::ScalarField
source · [−]pub trait ScalarField: FieldExt + Hash {
fn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>;
fn to_bytes_le(&self) -> Vec<u8>;
fn from_bytes_le(bytes: &[u8]) -> Self { ... }
}
Expand description
Required Methods
sourcefn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>
fn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>
Returns the base 2<sup>bit_len</sup>
little endian representation of the ScalarField element up to num_limbs
number of limbs (truncates any extra limbs).
Assumes bit_len < 64
.
num_limbs
: number of limbs to returnbit_len
: number of bits in each limb
sourcefn to_bytes_le(&self) -> Vec<u8>
fn to_bytes_le(&self) -> Vec<u8>
Returns the little endian byte representation of the element.
Provided Methods
sourcefn from_bytes_le(bytes: &[u8]) -> Self
fn from_bytes_le(bytes: &[u8]) -> Self
Creates a field element from a little endian byte representation.
The default implementation assumes that PrimeField::from_repr
is implemented for little-endian.
It should be overriden if this is not the case.
Implementors
impl<F> ScalarField for Fwhere
F: FieldExt + Hash,
We do a blanket implementation in ‘community-edition’ to make it easier to integrate with other crates.
ASSUMING F::Repr is little-endian