playfair_cipher
Implementation of the PlayFair cipher - nothing special, nothing useful, just for fun.
Encrypt
use ;
let pfc = new;
match pfc.encrypt ;
Decrypt
use ;
let pfc = new;
match pfc.decrypt ;
That's it.
Implementation of the PlayFair cipher - nothing special, nothing useful, just for fun.
use playfair_cipher::{PlayFairKey, CharNotInKeyError};
let pfc = PlayFairKey::new("playfair example");
match pfc.encrypt("hide the gold in the tree stump") {
Ok(crypt) => {
assert_eq!(crypt, "BMODZBXDNABEKUDMUIXMMOUVIF");
}
Err(e) => panic!("CharNotInKeyError {}", e),
};
use playfair_cipher::{PlayFairKey, CharNotInKeyError};
let pfc = PlayFairKey::new("playfair example");
match pfc.decrypt("BMODZBXDNABEKUDMUIXMMOUVIF") {
Ok(crypt) => {
assert_eq!(crypt, "HIDETHEGOLDINTHETREXESTUMP");
}
Err(e) => panic!("CharNotInKeyError {}", e),
};
That's it.