in src/hashwires.rs [624:687]
fn test_hashwires_inner_functions() -> Result<(), HwError> {
let max_number_bits = 32;
let base = 4;
let mdp_tree_height = 4;
let value = BigUint::from_str_radix("212", 4).unwrap();
let seed = [0u8; 32];
let threshold = BigUint::from_str_radix("201", 4).unwrap();
let hw_commit_and_proof = larger_than_proof_gen::<Blake3>(
&threshold,
&value,
base,
&seed,
max_number_bits,
mdp_tree_height,
)?;
assert_eq!(
hex::encode(&hw_commit_and_proof.0),
"f2829e0e39d30fe589f79b866947bc93b9d6585193705bea3a5dc03eaa59eb02"
);
assert!(proof_verify::<Blake3>(
&threshold,
base,
&hw_commit_and_proof.0,
&hw_commit_and_proof.1,
&hw_commit_and_proof.2,
&hw_commit_and_proof.3,
&hw_commit_and_proof.4
)?);
let max_digits = 32;
let base = 16;
let mdp_tree_height = 3;
let value = BigUint::from_str_radix("1AB", 16).unwrap();
let seed = [0u8; 32];
let hw_commit = commit_gen::<Blake3>(&value, base, &seed, max_digits, mdp_tree_height)?;
assert_eq!(
hex::encode(hw_commit),
"611a69247b1e60e269459546d6abc6c573e50b3edf50e61139ea57d416108892"
);
let max_digits = 64;
let base = 256;
let mdp_tree_height = 3;
let value = BigUint::from_str_radix("18446744073709551614", 10).unwrap();
let seed = [0u8; 32];
let hw_commit = commit_gen::<Blake3>(&value, base, &seed, max_digits, mdp_tree_height)?;
assert_eq!(
hex::encode(hw_commit),
"2647d6e7aaa0c752f4adb7cff9274cb7f4f6a7952002741b85628dc8ac06a81e"
);
let max_digits = 128;
let base = 256;
let mdp_tree_height = 4;
let value = BigUint::from_str_radix("23479534957845324957342523490585324", 10).unwrap();
let seed = [0u8; 32];
let hw_commit = commit_gen::<Blake3>(&value, base, &seed, max_digits, mdp_tree_height)?;
assert_eq!(
hex::encode(hw_commit),
"6a896722c2328838d25ce63877e29d25b4a550d5c53f3c32f330f31d006bc9ca"
);
Ok(())
}