pub struct Vigenere { /* private fields */ }
Expand description
A Vigenère cipher.
This struct is created by the new()
method. See its documentation for more.
Trait Implementations§
Source§impl Cipher for Vigenere
impl Cipher for Vigenere
Source§fn new(key: String) -> Vigenere
fn new(key: String) -> Vigenere
Initialise a Vigenère cipher given a specific key.
§Panics
- The
key
is empty. - The
key
contains a non-alphabetic symbol.
Source§fn encrypt(&self, message: &str) -> Result<String, &'static str>
fn encrypt(&self, message: &str) -> Result<String, &'static str>
Encrypt a message using a Vigenère cipher.
§Examples
Basic usage:
use cipher_crypt::{Cipher, Vigenere};
let v = Vigenere::new(String::from("giovan"));
assert_eq!("O vsqee mmh vnl izsyig!", v.encrypt("I never get any credit!").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 Vigenère cipher.
§Examples
Basic usage:
use cipher_crypt::{Cipher, Vigenere};
let v = Vigenere::new(String::from("giovan"));
assert_eq!("I never get any credit!", v.decrypt("O vsqee mmh vnl izsyig!").unwrap());
type Key = String
type Algorithm = Vigenere
Auto Trait Implementations§
impl Freeze for Vigenere
impl RefUnwindSafe for Vigenere
impl Send for Vigenere
impl Sync for Vigenere
impl Unpin for Vigenere
impl UnwindSafe for Vigenere
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