Struct cipher_crypt::adfgvx::ADFGVX
[−]
[src]
pub struct ADFGVX { /* fields omitted */ }This struct is created by the new() method. See its documentation for more.
Trait Implementations
impl Cipher for ADFGVX[src]
type Key = (String, String)
type Algorithm = ADFGVX
fn new(key: (String, String)) -> Result<ADFGVX, &'static str>[src]
Initialise a ADFGVX cipher. All we are interested in is: - The 36 character key that will be stored in the Polybius square - The keyword that will be used to transpose the output of the Polybius square function
fn encrypt(&self, message: &str) -> Result<String, &'static str>[src]
Encrypt a message using a ADFGVX cipher.
Examples
Basic usage:
use cipher_crypt::{Cipher, ADFGVX}; let a = ADFGVX::new(( "ph0qg64mea1yl2nofdxkr3cvs5zw7bj9uti8".to_string(), "GERMAN".to_string(), )).unwrap(); let cipher_text = concat!( "gfxffgxgDFAXDAVGD gxvadaaxxXFDDFGGGFdfaxdav", "gdVDAGFAXVVxfddfgggfVVVAGFFA vvvagffaGXVADAAXX vdagfaxvvGFXFFGXG " ); assert_eq!( cipher_text, a.encrypt("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") .unwrap() );
fn decrypt(&self, ciphertext: &str) -> Result<String, &'static str>[src]
Decrypt a message using a ADFGVX cipher.
Examples
Basic usage:
use cipher_crypt::{Cipher, ADFGVX}; let a = ADFGVX::new(( "ph0qg64mea1yl2nofdxkr3cvs5zw7bj9uti8".to_string(), "GERMAN".to_string(), )).unwrap(); let cipher_text = concat!( "gfxffgxgDFAXDAVGD gxvadaaxxXFDDFGGGFdfaxdav", "gdVDAGFAXVVxfddfgggfVVVAGFFA vvvagffaGXVADAAXX vdagfaxvvGFXFFGXG " ); assert_eq!( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", a.decrypt(cipher_text).unwrap() );