diff --git a/crypto/frost/src/curve/mod.rs b/crypto/frost/src/curve/mod.rs index ea8c8696..5d8cf791 100644 --- a/crypto/frost/src/curve/mod.rs +++ b/crypto/frost/src/curve/mod.rs @@ -6,7 +6,7 @@ use rand::{RngCore, CryptoRng}; use zeroize::{Zeroize, Zeroizing}; use subtle::ConstantTimeEq; -use digest::Digest; +use digest::{Digest, Output}; use group::{ ff::{Field, PrimeField}, @@ -41,8 +41,8 @@ pub trait Curve: Ciphersuite { const CONTEXT: &'static [u8]; /// Hash the given dst and data to a byte vector. Used to instantiate H4 and H5. - fn hash_to_vec(dst: &[u8], data: &[u8]) -> Vec { - Self::H::digest([Self::CONTEXT, dst, data].concat()).as_ref().to_vec() + fn hash(dst: &[u8], data: &[u8]) -> Output { + Self::H::digest([Self::CONTEXT, dst, data].concat()) } /// Field element from hash. Used during key gen and by other crates under Serai as a general @@ -53,13 +53,13 @@ pub trait Curve: Ciphersuite { } /// Hash the message for the binding factor. H4 from the IETF draft. - fn hash_msg(msg: &[u8]) -> Vec { - Self::hash_to_vec(b"msg", msg) + fn hash_msg(msg: &[u8]) -> Output { + Self::hash(b"msg", msg) } /// Hash the commitments for the binding factor. H5 from the IETF draft. - fn hash_commitments(commitments: &[u8]) -> Vec { - Self::hash_to_vec(b"com", commitments) + fn hash_commitments(commitments: &[u8]) -> Output { + Self::hash(b"com", commitments) } /// Hash the commitments and message to calculate the binding factor. H1 from the IETF draft.