pub struct Autokey { /* private fields */ }
Expand description

An Autokey cipher.

This struct is created by the new() method. See its documentation for more.

Trait Implementations§

Initialise an Autokey cipher given a specific key.

Panics
  • The key contains non-alphabetic symbols.
  • The key is empty.

Encrypt a message using an Autokey cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Autokey};

let a = Autokey::new(String::from("fort"));
assert_eq!("Fhktcd 🗡 mhg otzx aade", a.encrypt("Attack 🗡 the east wall").unwrap());

Decrypt a message using an Autokey cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Autokey};

let a = Autokey::new(String::from("fort"));;
assert_eq!("Attack 🗡 the east wall", a.decrypt("Fhktcd 🗡 mhg otzx aade").unwrap());

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.