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