pub struct Atbash;
Expand description
An Atbash cipher implementation.
Implementations§
Trait Implementations§
Source§impl Cipher for Atbash
impl Cipher for Atbash
Source§fn encipher(&self, ptext: &str) -> CipherResult
fn encipher(&self, ptext: &str) -> CipherResult
Enciphers the given plaintext (a str reference) using the Atbash cipher
and returns the ciphertext as a CipherResult
.
§Example
use ciphers::{Cipher, Atbash};
let atbash = Atbash::new();
let ctext = atbash.encipher("ATTACKATDAWN");
assert_eq!(ctext.unwrap(), "ZGGZXPZGWZDM");
Source§fn decipher(&self, ctext: &str) -> CipherResult
fn decipher(&self, ctext: &str) -> CipherResult
Deciphers the given ciphertext (a str reference) using the Atbash cipher
and returns the plaintext as a CipherResult
.
Note that the Atbash cipher is reciprocal.
§Example
use ciphers::{Cipher, Atbash};
let atbash = Atbash::new();
let ptext = atbash.decipher("ZGGZXPZGWZDM");
assert_eq!(ptext.unwrap(), "ATTACKATDAWN");
Auto Trait Implementations§
impl Freeze for Atbash
impl RefUnwindSafe for Atbash
impl Send for Atbash
impl Sync for Atbash
impl Unpin for Atbash
impl UnwindSafe for Atbash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more