fix domain separation and use simple primitives in examples.

This commit is contained in:
M Alghazwi 2026-05-14 11:56:12 +03:00
parent 9ff3fa3b49
commit 36b1269475
No known key found for this signature in database
GPG Key ID: 646E567CAD7DB607
3 changed files with 13 additions and 7 deletions

View File

@ -1,12 +1,15 @@
use anyhow::Result; use anyhow::Result;
use rand_core::{OsRng, RngCore}; 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::lioness::SEC_PARAM;
use lioness_blockcipher::prelude::*; use lioness_blockcipher::prelude::*;
type TestLioness = Lioness::< type TestLioness = Lioness::<
ChaCha20StreamCipher, Aes128CtrStreamCipher,
KeyedBlake2b, Sha256PrependKey,
TurboShake128Kdf DomSepSha256Kdf,
>; >;
fn prepend_before_enc() -> Result<()>{ fn prepend_before_enc() -> Result<()>{

View File

@ -1,9 +1,12 @@
use rand_core::{OsRng, RngCore}; 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::*; use lioness_blockcipher::prelude::*;
type TestLioness = Lioness::< type TestLioness = Lioness::<
ChaCha20StreamCipher, Aes128CtrStreamCipher,
KeyedBlake2b, Sha256PrependKey,
TurboShake128Kdf DomSepSha256Kdf,
>; >;
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {

View File

@ -63,7 +63,7 @@ const LIONESS_ROUND_KEY_DOMAINS: [&[u8]; 4] = [
b"lioness-key1", b"lioness-key1",
b"lioness-key2", b"lioness-key2",
b"lioness-key3", b"lioness-key3",
b"lionesskey4", b"lioness-key4",
]; ];
impl LionessKdf for DomSepSha256Kdf { impl LionessKdf for DomSepSha256Kdf {
fn derive_keys(master_key: &Key256) -> anyhow::Result<RoundKeys> { fn derive_keys(master_key: &Key256) -> anyhow::Result<RoundKeys> {