dev(cipher-traits): add KeyedHash(Instance) traits

This commit is contained in:
David Niehues
2025-02-11 10:57:11 +01:00
parent 62fe529d36
commit b36d30d89d
2 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
pub trait KeyedHash<const KEY_LEN: usize, const HASH_LEN: usize> {
type Error;
fn keyed_hash(key: &[u8; KEY_LEN], data: &[u8], out: &mut [u8; HASH_LEN]) -> Result<(), Self::Error>;
}
pub trait KeyedHashInstance<const KEY_LEN: usize, const HASH_LEN: usize> {
type KeyType;
type OutputType;
type Error;
fn keyed_hash(&self, key: &[u8; KEY_LEN], data: &[u8], out: &mut [u8; HASH_LEN]) -> Result<(), Self::Error>;
}

View File

@@ -1,2 +1,4 @@
mod kem;
mod keyed_hash;
pub use kem::Kem;
pub use keyed_hash::*;