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,
)
| 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. |
| 112 | pub(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] |
| 130 | pub(crate) fn get_num_bytes(n: usize) -> usize { |