pub struct Baconian { /* private fields */ }
Expand description
Baconian Cipher
The struct is generated through the new() function.
Implementations§
Source§impl Baconian
impl Baconian
Sourcepub fn new(distinct: bool) -> Result<Self, String>
pub fn new(distinct: bool) -> Result<Self, String>
Initializes a rail fence cipher with a supplied height.
§Examples
use kryptos::ciphers::baconian::Baconian;
let b = Baconian::new(true).unwrap();
Sourcepub fn encipher(&self, plaintext: &str) -> Result<String, String>
pub fn encipher(&self, plaintext: &str) -> Result<String, String>
Enciphers a message with a baconian cipher.
§Examples
use kryptos::ciphers::baconian::Baconian;
let b = Baconian::new(true).unwrap();
assert_eq!("ABBAABABAABAABABAABB AAAABAABAA ABABAAABAAABBBBBAABB AAAAA BAABAAABAAAAABABAAABAABAABAABB", b.encipher("Must be kept a secret").unwrap());
Sourcepub fn decipher(&self, ciphertext: &str) -> Result<String, String>
pub fn decipher(&self, ciphertext: &str) -> Result<String, String>
Deciphers a message with a baconian cipher.
§Examples
use kryptos::ciphers::baconian::Baconian;
let b = Baconian::new(true).unwrap();
assert_eq!("MUST BE KEPT A SECRET", b.decipher("ABBAABABAABAABABAABB AAAABAABAA ABABAAABAAABBBBBAABB AAAAA BAABAAABAAAAABABAAABAABAABAABB").unwrap());
Auto Trait Implementations§
impl Freeze for Baconian
impl RefUnwindSafe for Baconian
impl Send for Baconian
impl Sync for Baconian
impl Unpin for Baconian
impl UnwindSafe for Baconian
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