Crate playfair_rs

source ·
Expand description

playfair-rs: Playfair cipher implemented in Rust.

The Playfair cipher or Playfair square or Wheatstone-Playfair cipher is a manual symmetric encryption technique and was the first literal digram substitution cipher. The scheme was invented in 1854 by Charles Wheatstone but bore the name of Lord Playfair for promoting its use.

Examples

Encrypt

let encrypted = playfair_rs::encrypt("playfair example", "hide the gold in the tree stump", 'x').unwrap();
println!("{encrypted}"); // bmodzbxdnabekudmuixmmouvif

Decrypt

let decrypted = playfair_rs::decrypt("playfair example", "bmodzbxdnabekudmuixmmouvif").unwrap();
println!("{decrypted}"); // hidethegoldinthetrexestump

Functions

Deciphers the given ciphertext using the Playfair cipher and returns the plaintext.
Enciphers the given plaintext using the Playfair cipher and returns the ciphertext.