You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let values = lfsr.get_field_elements_rejection_sampling::<F>(rate);
231
-
for el in values {
232
-
ark.push(el);
228
+
let ark = {
229
+
letmut res = Vec::<F>::with_capacity((full_rounds + partial_rounds)asusize);
230
+
for _ in0..(full_rounds + partial_rounds){
231
+
let values = lfsr.get_field_elements_rejection_sampling::<F>(rate);
232
+
for el in values {
233
+
res.push(el);
234
+
}
233
235
}
234
-
}
236
+
res
237
+
};
235
238
236
-
letmut mds = Vec::<Vec<F>>::with_capacity(rate);
237
-
mds.resize(rate,vec![F::zero(); rate]);
239
+
let mds = {
240
+
letmut res = Vec::<Vec<F>>::with_capacity(rate);
241
+
res.resize(rate,vec![F::zero(); rate]);
238
242
239
-
// Note that we build the MDS matrix generating 2*rate elements. If the matrix built is not secure (see checks with algorithm 1, 2, 3 in reference implementation)
240
-
// it has to be skipped. Since here we do not implement such algorithm we allow to pass a parameter to skip generations of elements giving unsecure matrixes.
241
-
// At the moment, the skip_matrices parameter has to be generated from the reference implementation and passed to this function
242
-
for _ in0..skip_matrices {
243
-
let _ = lfsr.get_field_elements_mod_p::<F>(2*(rate));
244
-
}
243
+
// Note that we build the MDS matrix generating 2*rate elements. If the matrix built is not secure (see checks with algorithm 1, 2, 3 in reference implementation)
244
+
// it has to be skipped. Since here we do not implement such algorithm we allow to pass a parameter to skip generations of elements giving unsecure matrixes.
245
+
// At the moment, the skip_matrices parameter has to be generated from the reference implementation and passed to this function
246
+
for _ in0..skip_matrices {
247
+
let _ = lfsr.get_field_elements_mod_p::<F>(2*(rate));
248
+
}
245
249
246
-
// a qualifying matrix must satisfy the following requirements
247
-
// - there is no duplication among the elements in x or y
248
-
// - there is no i and j such that x[i] + y[j] = p
249
-
// - the resultant MDS passes all the three tests
250
+
// a qualifying matrix must satisfy the following requirements
251
+
// - there is no duplication among the elements in x or y
252
+
// - there is no i and j such that x[i] + y[j] = p
253
+
// - the resultant MDS passes all the three tests
250
254
251
-
let xs = lfsr.get_field_elements_mod_p::<F>(rate);
252
-
let ys = lfsr.get_field_elements_mod_p::<F>(rate);
255
+
let xs = lfsr.get_field_elements_mod_p::<F>(rate);
256
+
let ys = lfsr.get_field_elements_mod_p::<F>(rate);
0 commit comments