Trait cipher_crypt::Cipher
[−]
[src]
pub trait Cipher {
type Key;
type Algorithm;
fn new(key: Self::Key) -> Result<Self::Algorithm, &'static str>;
fn encrypt(&self, message: &str) -> Result<String, &'static str>;
fn decrypt(&self, message: &str) -> Result<String, &'static str>;
}
Associated Types
Required Methods
fn new(key: Self::Key) -> Result<Self::Algorithm, &'static str>
Initialise a cipher given a specific key.
fn encrypt(&self, message: &str) -> Result<String, &'static str>
Encrypt a message using a cipher's algorithm.
fn decrypt(&self, message: &str) -> Result<String, &'static str>
Decrypt a message using a cipher's algorithm.
Implementors
impl Cipher for Caesar type Key = usize; type Algorithm = Caesar;impl Cipher for Vigenere type Key = String; type Algorithm = Vigenere;impl Cipher for Railfence type Key = usize; type Algorithm = Railfence;impl Cipher for FractionatedMorse type Key = String; type Algorithm = FractionatedMorse;impl Cipher for Hill type Key = Matrix<isize>; type Algorithm = Hill;impl Cipher for Autokey type Key = String; type Algorithm = Autokey;impl Cipher for Affine type Key = (usize, usize); type Algorithm = Affine;impl Cipher for Polybius type Key = (String, [char; 6], [char; 6]); type Algorithm = Polybius;impl Cipher for Scytale type Key = usize; type Algorithm = Scytale;impl Cipher for ColumnarTransposition type Key = (String, Option<char>); type Algorithm = ColumnarTransposition;impl Cipher for ADFGVX type Key = (String, String, Option<char>); type Algorithm = ADFGVX;