feat: upgrade to winterfell 0.5

This commit is contained in:
Victor Lopez
2023-02-20 17:31:52 +01:00
parent 3c9a5235a0
commit 0af45b75f4
5 changed files with 59 additions and 24 deletions

View File

@@ -46,7 +46,7 @@ impl Digest for RpoDigest {
impl Serializable for RpoDigest {
fn write_into<W: ByteWriter>(&self, target: &mut W) {
target.write_u8_slice(&self.as_bytes());
target.write_bytes(&self.as_bytes());
}
}

View File

@@ -91,6 +91,15 @@ const INV_ALPHA: u64 = 10540996611094048183;
pub struct Rpo256();
impl Hasher for Rpo256 {
/// Rpo256 collision resistance is the same as the security level, that is 128-bits.
///
/// #### Collision resistance
///
/// However, our setup of the capacity registers might drop it to 126.
///
/// Related issue: [#69](https://github.com/0xPolygonMiden/crypto/issues/69)
const COLLISION_RESISTANCE: u32 = 128;
type Digest = RpoDigest;
fn hash(bytes: &[u8]) -> Self::Digest {