permutation-xoodoo

Crates.iopermutation-xoodoo
lib.rspermutation-xoodoo
version0.1.1
created_at2023-07-10 08:57:04.683506+00
updated_at2025-04-21 13:08:09.921809+00
descriptionXoodoo permutation in the `crypto-permutation` framework
homepage
repositoryhttps://github.com/niluxv/permutation_based_crypto
max_upload_size
id912740
size13,313
(niluxv)

documentation

README

permutation-xoodoo License: MIT OR Apache-2.0 permutation-xoodoo on crates.io permutation-xoodoo on docs.rs Source Code Repository Rust Version: 1.65.0

Xoodoo permutation in the crypto-permutation framework.

Xoodoo: Permutation

Example

Note: The following example makes use of very low-level cryptographic APIs, which you shouldn’t use unless you know very well what you are doing. The intended use of this crate is just to pass the XoodooP permutation as a parameter to some generic more high-level construction like Farfalle as implemented in deck-farfalle.

Suppose we want to apply the full 12-round Xoodoo permutation to the message "hello world" (and then padded with null-bytes to make it 42 bytes in length), and then get the first 3 bytes of output.

use permutation_xoodoo::{XoodooState, XoodooP};
use crypto_permutation::{Reader, Writer, Permutation, PermutationState};

// create a state and a permutation to act on it
let mut state = XoodooState::default();
let xoodoo = XoodooP::<12>::default();

// write input to the state
state.copy_writer().write_bytes(b"hello world");

// apply the xoodoo permutation to the state
xoodoo.apply(&mut state);

// and finally you can read the first 3 bytes of output
let mut out = [0u8; 3];
state.reader().write_to_slice(&mut out);
assert_eq!(out, [241, 234, 156]);
Commit count: 20

cargo fmt