1 unstable release

0.1.0 Oct 22, 2023

#458 in Configuration

22 downloads per month

GPL-3.0 license

175KB
603 lines

shark

A CLI Enigma tool named after the "Shark" Blackout of 1942, when the Kriegsmarine added a fourth rotor to their Enigma machines stymieing Bletchley Park's efforts to decipher Atlantic U-boat communications for nearly 10 months.

Installation

System wide:

$ curl -sSL https://github.com/mattlianje/shark/blob/main/install.sh | bash

# Checks system wide install was successful 
$ enigma --help

Build source:

$ git clone https://github.com/mattlianje/shark.git
$ cd shark
$ cargo build --release
$ echo "HELLOWORLD" | ./target/release/enigma
# Will output
ZWMRGTTIIZ

Use

# Chain enigma with other commands
$ echo "HELLO" | enigma | grep "FOO"

# Use your custom settings
$ cat config.json
{
    "rotors": [
        {"type_": "type_i", "position": "A", "ring_setting": "A"},
        {"type_": "type_ii", "position": "B", "ring_setting": "A"},
        {"type_": "type_iii", "position": "C", "ring_setting": "A"}
    ],
    "reflector": "ukw_b",
    "plugboard": [{"from": "A", "to": "B"}]
}

# Use these settings easily
$ enigma --input plaintext.txt --config config.json > encrypted.txt

Features/Goals

  • UNIX Philosophy Adherence: Shark focuses on doing one thing well: encryption.

  • Blazing Speed: Primarily built to learn about Rust, I will continue to work on lowering the memory footprint of shark and making use of Rust's concurrency. Shark processes data in chunks, making it suitable for large datasets and > 50x faster on 5MB inputs than other C++ cli enigmas.

Encryption times for 5MB of data:

Tool Time (ms)
shark 53
C++ cli 2693
  • Infinite Stream Capable: Designed with streaming data in mind, Shark can handle infinite data streams, allowing for real-time encryption tasks.

Dependencies

~1.9–3MB
~56K SLoC