Struct cipher_crypt::porta::Porta

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

A Porta cipher.

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

Trait Implementations§

Initialize a Porta cipher given a specific key.

Panics
  • The key is empty.
  • The key contains a non-alphabetic symbol.

Encrypt a message using a Porta cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Porta};

let v = Porta::new("melon".into());
assert_eq!(v.encrypt("We ride at dawn!").unwrap(), "Dt mpwx pb xtdl!");

Decrypt a message using a Porta cipher.

Examples

Basic usage:

use cipher_crypt::{Cipher, Porta};

let v = Porta::new(String::from("melon"));
assert_eq!(v.decrypt("Dt mpwx pb xtdl!").unwrap(), "We ride at dawn!");

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.