idea_crypto

Crates.ioidea_crypto
lib.rsidea_crypto
version0.2.9
sourcesrc
created_at2022-04-26 13:25:55.623685
updated_at2022-08-17 09:33:40.478869
descriptionPure Rust implementation of the idea algorithm
homepage
repositoryhttps://gitlab.com/andrew_ryan/idea_crypto
max_upload_size
id575392
size22,425
zinso (zinso)

documentation

https://docs.rs/idea_crypto

README

Pure Rust implementation of the idea algorithm

Examples

   //string
use idea_crypto::*;
let data = "This is plaintext".as_bytes();
let key = "this is password".as_bytes(); //key length can be any length
let enc = encrypt(data, key);
let dec = decrypt(enc.clone(), &key);

assert_eq!(
    enc,
    vec![
        vec![115, 247, 88, 166, 138, 225, 25, 243],
        vec![194, 236, 21, 196, 218, 159, 127, 117],
        vec![119, 7, 4, 154, 98, 218, 123, 31, 7]
    ]
);
assert_eq!(display_decrypt(dec), format!("This is plaintext"));

//test
let data1 = "This is another plaintext".as_bytes();
let key1 = "key length can be any length key length can be any length ".as_bytes();
let enc1 = encrypt(data1, key1);
let dec1 = decrypt(enc1, key1);
assert_eq!(display_decrypt(dec1), format!("This is another plaintext"));
encrypt_file("./0.txt", key1);
decrypt_file("./0.txt", key1);
Commit count: 11

cargo fmt