Skip to main content

encode_masked

Function encode_masked 

Source
pub fn encode_masked<F, P, NTT, A>(
    params: &FRIParams<F>,
    oracle_index: usize,
    ntt: &NTT,
    message: FieldBuffer<P, FieldSliceData<'_, P>>,
    rng: impl CryptoRng,
    alloc: &A,
) -> MaskedCodeword<P, <A as Allocator>::Vec<P>>
where F: BinaryField, P: PackedField<Scalar = F>, NTT: AdditiveNTT<Field = F> + Sync, A: Allocator,
Expand description

Generates a random mask, interleaves it with the message, and Reed-Solomon encodes.

This is used for zero-knowledge FRI commitments. The function generates a random mask of equal length to the input message, concatenates message || mask as the interleaved message (with log_batch_size = 1), and performs Reed-Solomon encoding. The returned codeword is committed by sending it over a Merkle channel, like encode_interleaved’s.

§Arguments

  • params - the (possibly batched) FRI parameters.
  • oracle_index - the index into FRIParams::input_oracles of the oracle being encoded; its spec must have log_batch_size == 1 and log_msg_len - 1 == message.log_len().
  • ntt - the additive NTT for Reed-Solomon encoding
  • message - the raw message to encode (not doubled)
  • rng - cryptographic RNG for mask generation
  • alloc - the allocator the mask, the codeword, and the concatenation temporary are drawn from