Crate cipha

source
Expand description

§Cipha

Cipha is a simple CLI and Package for classical Ciphers and Cryptography in Rust

cipha consist of two main part the cipha and cipha-cli.

§Installation

Simply put the following in your Cargo.toml.

[dependencies]
cipha = "0.1.0"

Or use cargo add cipha

§Usage

E.g. using the Functional Approach.

use cipha::utils::rot13;

fn main() {
 let input = "Hello, World!".to_string();
 let output = rot13(input);
 assert_eq!(output, "Uryyb, Jbeyq!");
}
§Using the Struct Based Approach.
use cipha::ciphers::{Rot13Cipher};

fn main() {
 let r1 = Rot13Cipher::new();
 let encrypted = r1.encipher("Some string");
 let decrypted = r1.decipher(&encrypted);
 println!("Encrypted: {}, Decrypted: {}", encrypted, decrypted);
}

Modules§