Skip to content

Commit

Permalink
Add wrapper types for hashers
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Aug 9, 2023
1 parent 5d8b7f0 commit 7bcb57e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ use crate::{
keys::SecretKey,
};

/// Wrapper type for 256-bit `Blake2` hasher
pub type Blake2b256 = Blake2b<U32>;

/// Wrapper type for 512-bit `Blake2` hasher
pub type Blake2b512 = Blake2b<U64>;

/// The `DomainSeparation` trait is used to inject domain separation tags into the [`DomainSeparatedHasher`] in a
/// way that can be applied consistently, but without hard-coding anything into the hasher itself.
///
Expand Down Expand Up @@ -418,9 +424,9 @@ impl LengthExtensionAttackResistant for Blake2bVar {}

impl LengthExtensionAttackResistant for Sha3_256 {}

impl LengthExtensionAttackResistant for Blake2b<U32> {}
impl LengthExtensionAttackResistant for Blake2b256 {}

impl LengthExtensionAttackResistant for Blake2b<U64> {}
impl LengthExtensionAttackResistant for Blake2b512 {}

//------------------------------------------------ HMAC ------------------------------------------------------------
/// A domain separation tag for use in MAC derivation algorithms.
Expand Down

0 comments on commit 7bcb57e

Please sign in to comment.