Crates.io | libpermute |
lib.rs | libpermute |
version | 1.0.1 |
source | src |
created_at | 2021-11-17 02:44:48.371391 |
updated_at | 2021-11-23 20:31:42.935381 |
description | A `no_std` compatible library that provides a function to permute the items of a slice. |
homepage | https://github.com/DaGenix/libpermute |
repository | https://github.com/DaGenix/libpermute |
max_upload_size | |
id | 483131 |
size | 25,896 |
libpermute is a no_std
compatible library that provides a function
to permute the items of a slice.
libpermute offers a few main features:
Stability. The permutation algorithm won't be changed without a major version bump.
Re-implementability. It should be relatively straightforward to re-implement the algorithm this library uses in another library or in another language.
Strength. Given an unpredictable permute_key, the permutation should also be unpredictable - assuming that no one breaks the Sha-256 or ChaChar20 algorithms.
use libpermute::permute;
fn main() {
const KEY: &'static [u8] = &[0, 1, 2, 3, 4, 5, 6, 7];
const INPUT: &str = "Hello World!";
let mut buff = [0u8; INPUT.len()];
buff.copy_from_slice(INPUT.as_bytes());
permute(KEY, &mut buff);
println!("RESULT: '{}'", std::str::from_utf8(&buff).unwrap());
}
No_std mode may be activated by disabling the "std" feature.
This project is licensed under either of
at your option.