MCPcopy Create free account
hub / github.com/BitVM/BitVM / fq_to_chunked_bits

Function fq_to_chunked_bits

bitvm/src/chunk/helpers.rs:28–42  ·  view source on GitHub ↗
(fq: BigInt<4>, limb_size: usize)

Source from the content-addressed store, hash-verified

26}
27
28fn fq_to_chunked_bits(fq: BigInt<4>, limb_size: usize) -> Vec<u32> {
29 let bits: Vec<bool> = ark_ff::BitIteratorBE::new(fq.as_ref()).collect();
30 assert!(bits.len() == 256);
31 bits.chunks(limb_size)
32 .map(|chunk| {
33 let mut factor = 1;
34 let res = chunk.iter().rev().fold(0, |acc, &x| {
35 let r = acc + if x { factor } else { 0 };
36 factor *= 2;
37 r
38 });
39 res
40 })
41 .collect()
42}
43
44pub(crate) fn extern_hash_fps(fqs: Vec<ark_bn254::Fq>) -> [u8; 64] {
45 let mut msgs: Vec<[u8; 64]> = Vec::new();

Callers 2

extern_bigint_to_nibblesFunction · 0.85
extern_hash_fpsFunction · 0.85

Calls 1

as_refMethod · 0.80

Tested by

no test coverage detected