#duplex #crypto #no-std #xoodyak

yanked cyclist

A generic Rust implementation of the Cyclist mode of permutation-based cryptography (e.g. Xoodyak).

12 releases (4 breaking)

0.6.3 Oct 17, 2022
0.5.0 Oct 1, 2022
0.1.0 May 8, 2022

#7 in #duplex

Download history 4/week @ 2024-03-14 15/week @ 2024-03-28 19/week @ 2024-04-04

801 downloads per month

MIT license

42KB
833 lines

cyclist

A Rust implementation of the Cyclist mode of permutation-based cryptography.

Includes Xoodyak and several Keccak-p based constructions (affectionately called Keccyak).

License

Copyright © 2020-2022 Coda Hale, Frank Denis

(Some portions adapted from rust-xoodyak.)

Distributed under the MIT License.


lib.rs:

Cyclist is a mode of operation on top of a full-state keyed duplex construction which provides fine-grained symmetric-key cryptographic services via stateful objects.

Message Digests

use cyclist::Cyclist;
use cyclist::xoodyak::XoodyakHash;

let mut hash = XoodyakHash::default();
hash.absorb(b"This is an input message!");
let digest = hash.squeeze(16);

assert_eq!(digest, vec![24, 79, 57, 49, 133, 57, 228, 222, 11, 95, 145, 57, 76, 16, 16, 122]);

Message Authentication Codes

use cyclist::Cyclist;
use cyclist::xoodyak::XoodyakKeyed;

let mut mac = XoodyakKeyed::new(b"This is a secret key!", b"", b"");
mac.absorb(b"This is an input message!");
let tag = mac.squeeze(16);

assert_eq!(tag, vec![194, 166, 86, 80, 74, 62, 172, 115, 122, 107, 186, 213, 252, 82, 239, 186]);

Authenticated Encryption And Data

use cyclist::Cyclist;
use cyclist::xoodyak::XoodyakKeyed;

let mut aead = XoodyakKeyed::new(b"This is a secret key!", b"This is a nonce!", b"");
aead.absorb(b"This is authenticated data!");
let ciphertext = aead.seal(b"This is the plaintext!");

assert_eq!(ciphertext, vec![100, 182, 152, 49, 219, 148, 32, 124, 17, 34, 159, 169, 12, 246, 224, 13, 23, 115, 47, 175, 149, 159, 145, 238, 190, 53, 77, 235, 98, 255, 52, 48, 54, 219, 148, 27, 208, 58]);

Dependencies

~19KB