Skip to main content

split_pf_to_field_order_limbs

Function split_pf_to_field_order_limbs 

Source
pub fn split_pf_to_field_order_limbs<SF: PrimeField, TF: PrimeField32>(
    val: SF,
    num_limbs: usize,
) -> Vec<TF>
Expand description

Split val into num_limbs little-endian base-|TF| limbs, each mapped into TF.

Decomposes val as c0 + c1·p + c2·p² + … (p = TF::ORDER_U32), returning [c0, c1, …, c_{num_limbs-1}] with 0 ≤ ci < p. Pads with TF::ZERO if val has fewer significant digits than num_limbs.

Use squeeze_field_order_num_limbs to choose num_limbs such that each retained limb is near-uniform over all of TF when val is uniformly random.