Clarify FROST's hash functions

Updates the keygen challenge to a format not vulnerable to collisions 
due to having multiple variable length elements.
This commit is contained in:
Luke Parker
2022-05-28 20:34:44 -04:00
parent b5bdb545cc
commit 244d1b6b68
5 changed files with 33 additions and 28 deletions

View File

@@ -48,11 +48,13 @@ impl Curve for Secp256k1 {
(&Sha256::digest(msg)).to_vec()
}
fn hash_binding_factor(binding: &[u8]) -> Self::F {
Self::hash_to_F(&[b"rho", binding].concat())
}
// Use wide reduction for security
fn hash_to_F(data: &[u8]) -> Self::F {
Scalar::from_uint_reduced(
U512::from_be_byte_array(Sha512::new().chain_update("rho").chain_update(data).finalize())
)
Scalar::from_uint_reduced(U512::from_be_byte_array(Sha512::digest(data)))
}
fn F_len() -> usize {