Struct cipher_crypt::railfence::Railfence
source · pub struct Railfence { /* private fields */ }
Trait Implementations§
source§impl Cipher for Railfence
impl Cipher for Railfence
source§fn encrypt(&self, message: &str) -> Result<String, &'static str>
fn encrypt(&self, message: &str) -> Result<String, &'static str>
Encrypt a message using a Railfence cipher.
Examples
Basic usage:
use cipher_crypt::{Cipher, Railfence};
let r = Railfence::new(3);
assert_eq!("Src s!ue-ertmsaepseeg", r.encrypt("Super-secret message!").unwrap());
source§fn decrypt(&self, ciphertext: &str) -> Result<String, &'static str>
fn decrypt(&self, ciphertext: &str) -> Result<String, &'static str>
Decrypt a message using a Railfence cipher.
Examples
Basic usage:
use cipher_crypt::{Cipher, Railfence};
let r = Railfence::new(3);
assert_eq!("Super-secret message!", r.decrypt("Src s!ue-ertmsaepseeg").unwrap());