Crate ruscrypt

Source
Expand description

§RusCrypt - Lightning-fast cryptography toolkit

RusCrypt is a comprehensive cryptography library and CLI tool built with Rust, featuring:

  • Classical ciphers: Caesar, Vigenère, Playfair, Rail Fence
  • Stream ciphers: RC4
  • Block ciphers: AES (128/192/256-bit), DES
  • Asymmetric encryption: RSA, Diffie-Hellman key exchange
  • Hash functions: MD5, SHA-1, SHA-256

§Library Usage

use ruscrypt::classical::caesar;
use ruscrypt::hash::sha256;

// Caesar cipher encryption
let encrypted = caesar::encrypt("Hello World", 3).unwrap();
assert_eq!(encrypted, "Khoor Zruog");

// SHA-256 hashing
let hash = sha256::hash("password").unwrap();
println!("SHA-256: {}", hash);

§CLI Usage

Install the binary:

cargo install ruscrypt

Use the CLI:

# Encrypt with Caesar cipher
ruscrypt encrypt --caesar

# Hash with SHA-256
ruscrypt hash --sha256

# Key exchange with Diffie-Hellman
ruscrypt exchange --dh

§Security Warning

⚠️ Important: This library is designed for educational purposes and experimentation. Some algorithms (RC4, DES, MD5, SHA-1, classical ciphers) are not cryptographically secure for modern use. For production applications, use AES-256 and RSA with appropriate key sizes.

§Features

  • Zero dependencies for core crypto algorithms (implementations from scratch)
  • Memory safe - leverages Rust’s ownership system
  • Fast execution - optimized for performance
  • Educational focus - clean, readable implementations
  • CLI and library - use as a command-line tool or integrate into your project

Re-exports§

pub use asym::*;
pub use block::*;
pub use classical::*;
pub use hash::*;
pub use stream::*;

Modules§

asym
Asymmetric cryptography (RSA, Diffie-Hellman)
block
Block cipher implementations (AES, DES)
classical
Classical cipher implementations (Caesar, Vigenère, Playfair, Rail Fence)
cli
Command Line Interface Module
dispatcher
Command Dispatcher Module
hash
Cryptographic hash functions (MD5, SHA-1, SHA-256)
interactive
Interactive User Input Module
stream
Stream cipher implementations (RC4)
utils
Utility Functions for Cryptographic Operations

Constants§

VERSION
Library version information

Functions§

quick_example
Quick example demonstrating basic library usage
version
Get the current library version