1 unstable release
0.1.0 | Dec 28, 2022 |
---|
#2465 in Cryptography
15KB
233 lines
playfair_cipher_rs
Implement the Playfair cipher (https://en.wikipedia.org/wiki/Playfair_cipher) in Rust.
lib.rs
:
playfair_cipher_rs
This crate provides a simple implementation of the Playfair Cipher. You can use this crate to encrypt and decrypt messages using the Playfair Cipher. Currently, this crate only supports the English alphabet. Please note that the Playfair Cipher does not support the letter J. The letter J is replaced with the letter I.
Please see the Playfair Cipher Wikipedia article for more information.
Examples
use playfair_cipher_rs::Playfair;
let playfair = Playfair::new("playfair example".to_string());
let cipher_text = playfair.encrypt("Hide the gold in the tree stump".to_string());
assert_eq!(cipher_text, "BMODZBXDNABEKUDMUIXMMOUVIF");