Expand description
Generic implementations of the BEAR, LION, and LIONESS large-block ciphers of
Anderson & Biham, each built from a stream cipher S and a hash H:
Bear— keyed hash twice, stream once (3 rounds); requiresH:Mac+KeyInit.Lion— stream twice, unkeyed hash once (3 rounds); requiresH:Digest.Lioness— stream twice and keyed hash twice (4 rounds); requiresH:Mac+KeyInit.
All three are #![no_std] and allocation-free.
§Example
use blake3::Hasher as Blake3;
use chacha20::ChaCha20;
use lioness_rs::{Array, KeyInit, Lioness};
// ChaCha20 (32-byte key) + BLAKE3 (32-byte key & output).
// The full key is k1 || k2 || k3 || k4 = 2 * (32 + 32) = 128 bytes.
type Cipher = Lioness<ChaCha20, Blake3>;
let key = Array::from([0u8; 128]);
let cipher = Cipher::new(&key);
// A block must be strictly longer than the hash output (here, > 32 bytes).
let mut block = [69u8; 96];
cipher.encrypt_block(&mut block).unwrap();
assert_ne!(block, [69u8; 96]);
cipher.decrypt_block(&mut block).unwrap();
assert_eq!(block, [69u8; 96]);Re-exports§
Structs§
- Array
Arrayis a newtype for an inner[T; N]array whereNis determined by a genericArraySizeparameter, which is a marker trait for a numeric value determined by ZSTs that impl thetypenum::Unsignedtrait.- Bear
- The BEAR large-block cipher, generic over a stream cipher
Sand a keyed hash (MAC)H. - Invalid
Block Length - Lion
- The LION large-block cipher, generic over a stream cipher
Sand an unkeyed hashH. - Lioness
- The LIONESS large-block cipher, generic over a stream cipher
Sand a keyed hash (MAC)H.
Traits§
- Digest
- Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
- KeyInit
- Types which can be initialized from a key.
- KeySize
User - Types which use key for initialization.
- Mac
- Convenience wrapper trait covering functionality of Message Authentication algorithms.
Type Aliases§
- Key
- Key used by
KeySizeUserimplementors.