idea_algorithm

Crates.ioidea_algorithm
lib.rsidea_algorithm
version0.1.2
sourcesrc
created_at2022-04-26 03:20:50.569524
updated_at2022-04-26 10:13:49.685145
descriptionPure Rust implementation of the idea algorithm
homepage
repository
max_upload_size
id574223
size33,262
nano (rustdeno)

documentation

https://docs.rs/idea_algorithm/

README

Pure Rust implementation of the idea algorithm

Examples

use idea_algorithm::decrypt;
use idea_algorithm::display_decrypt;
use idea_algorithm::encrypt;
let data = "I like rust,do't ask me why?".as_bytes();
//key length must be equal to 16
let key = "alen_andryalen_a".as_bytes();
let enc = encrypt(data.to_vec(), key.to_vec());
let dec = decrypt(enc.to_vec(), key.to_vec());
assert_eq!(
enc,
vec![
    vec![227, 50, 135, 181, 96, 140, 192, 61],
    vec![14, 26, 91, 233, 40, 203, 211, 156],
    vec![25, 159, 71, 85, 37, 42, 209, 92],
    vec![202, 44, 159, 167, 57, 84, 106, 170, 150, 160, 226, 150, 160, 226, 150, 160]
]
);
assert_eq!(
    display_decrypt(dec),
    format!("I like rust,do't ask me why?")
);
Commit count: 0

cargo fmt