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]

[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

[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()
);

[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()
);