diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2026-04-28 17:59:14 +0200 |
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2026-04-28 17:59:14 +0200 |
| commit | 8c54e253451cc4c6578f86db25a057fbf702fd4b (patch) | |
| tree | 77b16cb4423d816f0b2ee0e57cd9ded8f23d2c3a | |
| parent | 13fb026842345a5aad0cb7788bf327e03b521222 (diff) | |
| download | leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.tar.gz leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.tar.bz2 leona-8c54e253451cc4c6578f86db25a057fbf702fd4b.zip | |
add metadata
| -rw-r--r-- | Cargo.toml | 6 | ||||
| -rw-r--r-- | LICENSE | 7 | ||||
| -rw-r--r-- | README.md | 60 |
3 files changed, 73 insertions, 0 deletions
@@ -2,6 +2,12 @@ name = "leona" version = "0.1.0" edition = "2024" +license = "MIT" +description = "LIONESS cipher construction" +readme = "README.md" +repository = "https://codeberg.org/dunj3/leona" +keywords = ["lioness", "encryption", "cipher"] +categories = ["algorithms", "cryptography"] [dependencies] blake2 = "0.11.0-rc.6" @@ -0,0 +1,7 @@ +Copyright 2026 Daniel Schadt + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f11059c --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# leona + +[](https://crates.io/crates/leona) +[](https://choosealicense.com/licenses/mit/) +[](https://docs.rs/leona) + +Implementation of +[LIONESS](https://link.springer.com/content/pdf/10.1007/3-540-60865-6_48.pdf) +in Rust. Works with `no_std` and generic over hashes/ciphers. + +## ☣️ Cryptographic hazmat ☣️ + +This crate is not battle tested and not audited. It exists as a learning +exercise. Use it at your own risk. + +## LIONESS + +LIONESS is a wide block cipher, constructed using a hash algorithm and a stream +cipher. From the paper: + +> Each ciphertext bit depends on all the plaintext bits in a very complex way, +> which contributes to the cryptographic strength. + +## Example use + +You need a hash algorithm and a compatible stream cipher (compatible means that +the hash output has the same size as the stream cipher key): + +```rust +use leona::{Lioness, ZeroIv}; +use blake2::Blake2sMac256; +use chacha20::ChaCha20; + +type Cipher = Lioness<ZeroIv<ChaCha20>, Blake2sMac256>; + +let mut data = [0u8; 64]; +data[..11].copy_from_slice(b"hello world"); + +let cipher = Cipher::new_dynamic(b"secret"); +cipher.encrypt(&mut data); +assert_ne!(&data[..11], b"hello world"); +cipher.decrypt(&mut data); +assert_eq!(&data[..11], b"hello world"); +``` + +## Alternatives + +There are two drawbacks to LIONESS: + +1. It is slow. +2. It cannot encrypt short messages (shorther than the hash output size). + +If you require a wide block cipher, consider using a different construction +(like aez via [aez](https://crates.io/crates/aez) or +[zears](https://crates.io/crates/zears)). + +## License + +This crate is licensed under the terms of the MIT license. You can find the full license text in LICENSE. + |
