0.1.2 |
|
---|---|
0.1.1 |
|
0.1.0 |
|
#39 in #idea
32KB
620 lines
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?")
);
lib.rs
:
Pure Rust implementation of the idea algorithm.
Dependencies
~385KB