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.