in src/hashwires.rs [579:605]
fn prove_and_verify(
base: u32,
max_number_bits: usize,
value: &BigUint,
threshold: &BigUint,
) -> Result<(), HwError> {
// Pick a random 32-byte seed.
let mut rng = OsRng;
let mut seed = vec![0u8; 32];
rng.fill_bytes(&mut seed);
// Generate secret.
let secret = Secret::<Blake3>::gen(&seed, &value);
// Generate and serialize commitment.
let commitment = secret.commit(base, max_number_bits)?;
let commitment_bytes = commitment.serialize();
// Generate and serialize a HashWires proof.
let proof = secret.prove(base, max_number_bits, &threshold)?;
let proof_bytes = proof.serialize();
// Verify a range proof over a commitment.
commitment.verify(&proof, &threshold)?;
Commitment::<Blake3>::deserialize(&commitment_bytes, base)
.verify(&Proof::deserialize(&proof_bytes)?, &threshold)
}