https://github.com/thepuzzlemaker/co2
CO₂: Human ciphers, implemented in Rust.
https://github.com/thepuzzlemaker/co2
Last synced: 11 months ago
JSON representation
CO₂: Human ciphers, implemented in Rust.
- Host: GitHub
- URL: https://github.com/thepuzzlemaker/co2
- Owner: ThePuzzlemaker
- Created: 2020-12-29T09:33:41.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-29T09:34:48.000Z (over 5 years ago)
- Last Synced: 2025-01-29T16:12:26.551Z (over 1 year ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CO₂: Human ciphers, implemented in Rust.
CO₂ (a.k.a. "Cipherium Dioxide", or perhaps "Cipher Dioxide", or just "C-O-2" if you insist) is an extensible Rust library for "human ciphers" (which are simpler ciphers, such as the Caesar cipher or Vigenère cipher).
## Example (proposed API)
```rs
use co2::prelude::*;
use subst::VigenereBuilder;
fn main() {
// Build the cipher encoder/decoder for a standard Vigenère cipher
// with the key `ciphersarecool`. Everything else should be set to
// the default.
let c = VigenereBuilder::standard().key("ciphersarecool").build();
// Encode "Hello, world!" using the Vigenère cipher with the
// previously set key. This returns a `String`, so to compare
// it with a `&str`, it needs some coaxing.
assert_eq!(&c.encode("Hello, world!"), "Jmass, ngrch!");
// Decode some encoded text with the previously set key.
// This returns a `String` too.
assert_eq!(&c.decode("Kb lvvbk!"), "It works!");
}
```