Creates randomness, commits to it and returns the commitments to be sent to the other parties. The randomness will serve as a share to the joint randomness. `batch_size` is the number of random values generated.
(
rng: &mut R,
id: ParticipantId,
batch_size: u32,
protocol_id: Vec<u8>,
)
| 40 | /// The randomness will serve as a share to the joint randomness. `batch_size` is the number of |
| 41 | /// random values generated. |
| 42 | pub fn commit<R: RngCore, D: Digest>( |
| 43 | rng: &mut R, |
| 44 | id: ParticipantId, |
| 45 | batch_size: u32, |
| 46 | protocol_id: Vec<u8>, |
| 47 | ) -> (Self, Commitments) { |
| 48 | let shares_and_salts = (0..batch_size) |
| 49 | .map(|_| { |
| 50 | let mut salt = [0; SALT_SIZE]; |
| 51 | rng.fill_bytes(&mut salt); |
| 52 | (F::rand(rng), salt) |
| 53 | }) |
| 54 | .collect::<Vec<_>>(); |
| 55 | let commitments = Self::compute_commitments::<D>(&shares_and_salts, &protocol_id); |
| 56 | ( |
| 57 | Self { |
| 58 | id, |
| 59 | protocol_id, |
| 60 | own_shares_and_salts: shares_and_salts, |
| 61 | other_commitments: Default::default(), |
| 62 | other_shares: Default::default(), |
| 63 | }, |
| 64 | Commitments(commitments), |
| 65 | ) |
| 66 | } |
| 67 | |
| 68 | /// Process received commitments to the shares from another party and store it |
| 69 | pub fn receive_commitment( |
nothing calls this directly
no test coverage detected