From 36b12694751dfb430191993fddc69ccb2fae899e Mon Sep 17 00:00:00 2001 From: M Alghazwi Date: Thu, 14 May 2026 11:56:12 +0300 Subject: [PATCH] fix domain separation and use simple primitives in examples. --- examples/auth.rs | 9 ++++++--- examples/simple_example.rs | 9 ++++++--- src/kdf.rs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/auth.rs b/examples/auth.rs index 5206e69..09e8a43 100644 --- a/examples/auth.rs +++ b/examples/auth.rs @@ -1,12 +1,15 @@ use anyhow::Result; use rand_core::{OsRng, RngCore}; +use lioness_blockcipher::cipher::Aes128CtrStreamCipher; +use lioness_blockcipher::kdf::DomSepSha256Kdf; +use lioness_blockcipher::keyed_hash::Sha256PrependKey; use lioness_blockcipher::lioness::SEC_PARAM; use lioness_blockcipher::prelude::*; type TestLioness = Lioness::< - ChaCha20StreamCipher, - KeyedBlake2b, - TurboShake128Kdf + Aes128CtrStreamCipher, + Sha256PrependKey, + DomSepSha256Kdf, >; fn prepend_before_enc() -> Result<()>{ diff --git a/examples/simple_example.rs b/examples/simple_example.rs index e6b20fc..5e88a88 100644 --- a/examples/simple_example.rs +++ b/examples/simple_example.rs @@ -1,9 +1,12 @@ use rand_core::{OsRng, RngCore}; +use lioness_blockcipher::cipher::Aes128CtrStreamCipher; +use lioness_blockcipher::kdf::DomSepSha256Kdf; +use lioness_blockcipher::keyed_hash::Sha256PrependKey; use lioness_blockcipher::prelude::*; type TestLioness = Lioness::< - ChaCha20StreamCipher, - KeyedBlake2b, - TurboShake128Kdf + Aes128CtrStreamCipher, + Sha256PrependKey, + DomSepSha256Kdf, >; fn main() -> anyhow::Result<()> { diff --git a/src/kdf.rs b/src/kdf.rs index e092cf0..4a3608e 100644 --- a/src/kdf.rs +++ b/src/kdf.rs @@ -63,7 +63,7 @@ const LIONESS_ROUND_KEY_DOMAINS: [&[u8]; 4] = [ b"lioness-key1", b"lioness-key2", b"lioness-key3", - b"lionesskey4", + b"lioness-key4", ]; impl LionessKdf for DomSepSha256Kdf { fn derive_keys(master_key: &Key256) -> anyhow::Result {