Struct cipher_crypt::caesar::Caesar

source ·
pub struct Caesar { /* private fields */ }
Expand description

A Caesar cipher.

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

Trait Implementations§

Initialise a Caesar cipher given a specific shift value.

Panics
  • shift is not in the inclusive range 1 - 26.

Encrypt a message using a Caesar cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Caesar};

let c = Caesar::new(3);
assert_eq!("Dwwdfn dw gdzq!", c.encrypt("Attack at dawn!").unwrap());

Decrypt a message using a Caesar cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Caesar};

let c = Caesar::new(3);
assert_eq!("Attack at dawn!", c.decrypt("Dwwdfn dw gdzq!").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.