2 releases

0.1.1 Apr 14, 2024
0.1.0 Apr 1, 2024

#1185 in Cryptography

31 downloads per month
Used in 2 crates (via dlwp)

MIT license

18KB
483 lines

Cerpton

A "double" Caesar cipher that contains a mix of different alphabets. Cerpton takes two values and shifts the "alphabet" starting from two different positions (a long with a few extra things).

Example:

use cerpton::{Encoder, libcerpton_encode};

let mut encoder = Encoder::new(2, 1);

// Creates a new ``Alphabet``
encoder.set_alphabet();

// Check if the input setting is ok
if !encoder.setting_good() {
    panic!("Invalid setting");
}

let regular_text = String::from("This is some text!!!");
let encoded_text = encoder.encode(regular_text);

println!("{} -> {}", regular_text, encoded_text);
// "This is some text!!!" -> "Sg  غ[ШJ KJwKللل"

// Or using a single function:
let encoded_text = libcerpton_encode([2, 1, 0, 0, 0, 0], regular_text);

Dependencies

~3MB
~119K SLoC