(
sec_param: usize,
distance: (usize, usize),
b: &[F],
mat: &Matrix<F>,
ext_mat: &Matrix<F>,
col_tree: &MerkleTree<C>,
sponge: &mut S,
)
| 521 | } |
| 522 | |
| 523 | fn generate_proof<F, C, S>( |
| 524 | sec_param: usize, |
| 525 | distance: (usize, usize), |
| 526 | b: &[F], |
| 527 | mat: &Matrix<F>, |
| 528 | ext_mat: &Matrix<F>, |
| 529 | col_tree: &MerkleTree<C>, |
| 530 | sponge: &mut S, |
| 531 | ) -> Result<LinCodePCProofSingle<F, C>, Error> |
| 532 | where |
| 533 | F: PrimeField + Absorb, |
| 534 | C: Config, |
| 535 | S: CryptographicSponge, |
| 536 | { |
| 537 | let t = calculate_t::<F>(sec_param, distance, ext_mat.m)?; |
| 538 | |
| 539 | // 1. left-multiply the matrix by `b`. |
| 540 | let v = mat.row_mul(b); |
| 541 | sponge.absorb(&v); |
| 542 | |
| 543 | // 2. Generate t column indices to test the linear combination on. |
| 544 | let indices = get_indices_from_sponge(ext_mat.m, t, sponge)?; |
| 545 | |
| 546 | // 3. Compute Merkle tree paths for the requested columns. |
| 547 | let mut queried_columns = Vec::with_capacity(t); |
| 548 | let mut paths = Vec::with_capacity(t); |
| 549 | |
| 550 | let ext_mat_cols = ext_mat.cols(); |
| 551 | |
| 552 | for i in indices { |
| 553 | queried_columns.push(ext_mat_cols[i].clone()); |
| 554 | paths.push( |
| 555 | col_tree |
| 556 | .generate_proof(i) |
| 557 | .map_err(|_| Error::TranscriptError)?, |
| 558 | ); |
| 559 | } |
| 560 | |
| 561 | Ok(LinCodePCProofSingle { |
| 562 | paths, |
| 563 | v, |
| 564 | columns: queried_columns, |
| 565 | }) |
| 566 | } |
no test coverage detected