MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / reed_solomon

Function reed_solomon

poly-commit/src/linear_codes/utils.rs:112–127  ·  view source on GitHub ↗

Apply reed-solomon encoding to msg. Assumes msg.len() is equal to the order of some FFT domain in F. Returns a vector of length equal to the smallest FFT domain of size at least msg.len() * RHO_INV.

(
    // msg, of length m, is interpreted as a vector of coefficients of a polynomial of degree m - 1
    msg: &[F],
    rho_inv: usize,
)

Source from the content-addressed store, hash-verified

110/// Assumes msg.len() is equal to the order of some FFT domain in F.
111/// Returns a vector of length equal to the smallest FFT domain of size at least msg.len() * RHO_INV.
112pub(crate) fn reed_solomon<F: FftField>(
113 // msg, of length m, is interpreted as a vector of coefficients of a polynomial of degree m - 1
114 msg: &[F],
115 rho_inv: usize,
116) -> Vec<F> {
117 let m = msg.len();
118
119 let extended_domain = GeneralEvaluationDomain::<F>::new(m * rho_inv).unwrap_or_else(|| {
120 panic!(
121 "The field F cannot accomodate FFT for msg.len() * RHO_INV = {} elements (too many)",
122 m * rho_inv
123 )
124 });
125
126 extended_domain.fft(msg)
127}
128
129#[inline]
130pub(crate) fn get_num_bytes(n: usize) -> usize {

Callers 3

test_reed_solomonFunction · 0.85
encodeMethod · 0.85
encodeMethod · 0.85

Calls 1

lenMethod · 0.80

Tested by 1

test_reed_solomonFunction · 0.68