1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
//! Thing
//!
pub trait Cipher {
    type Key;
    type Algorithm;

    /// Initialise a cipher given a specific `key`.
    ///
    fn new(key: Self::Key) -> Result<Self::Algorithm, &'static str>;

    /// Encrypt a `message` using a cipher's algorithm.
    ///
    fn encrypt(&self, message: &str) -> Result<String, &'static str>;

    /// Decrypt a `message` using a cipher's algorithm.
    ///
    fn decrypt(&self, message: &str) -> Result<String, &'static str>;
}