pub struct RailFence { /* private fields */ }
Expand description
A Rail-fence cipher implementation.
Implementations§
Trait Implementations§
Source§impl Cipher for RailFence
impl Cipher for RailFence
Source§fn encipher(&self, ptext: &str) -> CipherResult
fn encipher(&self, ptext: &str) -> CipherResult
Enciphers the given plaintext (a str reference) using the Rail-fence
cipher and returns the ciphertext as a CipherResult
.
§Example
use ciphers::{Cipher, RailFence};
let rail_fence = RailFence::new(4);
let ctext = rail_fence.encipher("DEFENDTHEEASTWALLOFTHECASTLE");
assert_eq!(ctext.unwrap(), "DTTFSEDHSWOTATFNEAALHCLEELEE");
Source§fn decipher(&self, ctext: &str) -> CipherResult
fn decipher(&self, ctext: &str) -> CipherResult
Deciphers the given ciphertext (a str reference) using the Rail-fence
cipher and returns the plaintext as a CipherResult
.
§Example
use ciphers::{Cipher, RailFence};
let rail_fence = RailFence::new(4);
let ptext = rail_fence.decipher("DTTFSEDHSWOTATFNEAALHCLEELEE");
assert_eq!(ptext.unwrap(), "DEFENDTHEEASTWALLOFTHECASTLE");
Auto Trait Implementations§
impl Freeze for RailFence
impl RefUnwindSafe for RailFence
impl Send for RailFence
impl Sync for RailFence
impl Unpin for RailFence
impl UnwindSafe for RailFence
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