caesarlib

Crates.iocaesarlib
lib.rscaesarlib
version0.2.0
sourcesrc
created_at2017-03-19 12:46:14.834917
updated_at2017-03-23 14:54:13.143923
descriptionA Caesar-Cipher library for Rust.
homepage
repositoryhttps://github.com/caesarlib/caesarlib.rs
max_upload_size
id9040
size11,511
Lukas A. Mueller (luki)

documentation

README

caesarlib

Caesar cipher capabilities for Rust.
Current Version Build Status

Usage

Add this to your Cargo.toml:

[dependencies]
caesarlib = "0.2.0"

and this to your crate root:

extern crate caesarlib;

use caesarlib::*;

Methods


// With custom base sequence
// Can look like "ABC...Zabc...z"

custom_encipher(base_seq: &str, offset: u16, message: &str) -> String

custom_decipher(base_seq: &str, offset: u16, message: &str) -> String

// With roman/latin characters
// Looks like the example for custom base sequences

fn encipher(offset: u16, message: &str) -> String;

fn decipher(offset: u16, message: &str) -> String;

// Returns randomly-generated offset and enciphered text
fn rdm_encipher(message: &str) -> (u16, String)

CLI tool

You can try the lib using the caesar-cli tool:

$ caesarlib --method encipher --offset 87 --text "Carolus Magnus"
Result: lJaXUdb vJPWdb
With Offset: 87

$ caesarlib --method decipher --offset 87 —text "lJaXUdb vJPWdb"
Result: Carolus Magnus
With Offset: 87

$ caesarlib --random --text "Carolus Magnus"
Result: qOfcZig AOUbig
With Offset: 51312

Contributors

Background

This was inspired by my Caesar Cipher algorithm implentation in Swift used in my iOS application caesarlib

Commit count: 101

cargo fmt