RusCrypt
⚡ Lightning-fast cryptography toolkit built with Rust ⚡
Modern cryptographic operations made simple and blazingly fast
📖 Documentation • 🚀 Quick Start • 💡 Examples • 🤝 Contributing • 📚 API Docs
📑 Table of Contents
- 🎯 Overview
- ✨ Features
- 📦 Installation
- 🚀 Quick Start
- 📖 Documentation
- 💡 Examples
- 🧪 Testing
- 🔒 Security
- 🤝 Contributing
- 📄 License
🎯 Overview
ruscrypt is a powerful command-line cryptography toolkit that brings together classical and modern cryptographic algorithms in one unified interface. Built with Rust for maximum performance, memory safety, and security.
🎓 Perfect for: Learning cryptography, educational purposes, quick encryption tasks, and understanding algorithm implementations.
Why ruscrypt?
| Feature | Description |
|---|---|
| ⚡ Blazing Fast | Rust's zero-cost abstractions ensure optimal performance |
| 🔒 Memory Safe | No buffer overflows or memory leaks |
| 🎯 Simple API | One command format for all algorithms |
| 📚 Educational | Clean implementations perfect for learning |
| 🔧 Interactive | Guided prompts for all required parameters |
✨ Features
| 🏛️ Classical Ciphers | 🔐 Stream & Block Ciphers | 🔑 Asymmetric Encryption | 🔢 Hash Functions |
|---|---|---|---|
| Caesar Cipher | RC4 | RSA | MD5 |
| Vigenère Cipher | AES (128/192/256) | Diffie-Hellman | SHA-1 |
| Playfair Cipher | DES (ECB/CBC) | - | SHA-256 |
| Rail Fence Cipher | AES (ECB/CBC) | - | - |
🏗️ Architecture Overview
The RusCrypt toolkit follows a modular architecture designed for extensibility and maintainability
Data Flow Architecture
sequenceDiagram
participant User
participant CLI
participant Dispatcher
participant Interactive
participant Algorithm
participant Utils
User->>CLI: Command with flags
CLI->>Dispatcher: Parsed arguments
Dispatcher->>Interactive: Prompt for inputs
Interactive->>User: Request parameters
User->>Interactive: Provide inputs
Interactive->>Dispatcher: User data
Dispatcher->>Algorithm: Execute operation
Algorithm->>Utils: Helper functions
Utils->>Algorithm: Processed data
Algorithm->>Dispatcher: Result
Dispatcher->>User: Formatted output
🏗️ Project Structure
ruscrypt/
├── Cargo.toml # Project manifest
├── README.md # Documentation
├── src/
│ ├── main.rs # Entry point
│ ├── lib.rs # Library exports
│ ├── cli.rs # CLI parsing
│ ├── dispatcher.rs # Command routing
│ ├── interactive.rs # User prompts
│ ├── utils.rs # Shared utilities
│ │
│ ├── classical/ # Classical ciphers
│ ├── stream/ # Stream ciphers
│ ├── block/ # Block ciphers
│ ├── asym/ # Asymmetric crypto
│ ├── hash/ # Hash functions
│ └── tests/ # Test modules
│ ├── mod.rs
│ ├── classical.rs
│ ├── stream.rs
│ ├── block.rs
│ ├── hash.rs
│ ├── asym.rs
📦 Installation
Prerequisites
- Rust: 1.70.0 or higher
Install from crates.io (Recommended)
# 📥 Install the CLI tool globally
# 🎯 Binary will be available in your PATH
Use as a Library
# 📚 Add to your Cargo.toml dependencies
# Or manually add to Cargo.toml:
# [dependencies]
# ruscrypt = "0.1.0"
Build from Source
# 📥 Clone the repository
# 🔨 Build in release mode for optimal performance
# 🎯 Binary will be available at
🚀 Quick Start
Command Format
# Get help information
# Check version
# For encryption and decryption
|
# For hashing operations
# For key exchange protocols
Interactive Experience
All operations are interactive - the tool will prompt you for required inputs:
# Example: Caesar cipher encryption
)
# Example: AES encryption
# Example: SHA-256 hashing
📖 Documentation
Algorithm Reference
🏛️ Classical Ciphers
# Encrypt
# Prompts:
# - Text to encrypt
# - Shift value (1-25)
# Decrypt
# Prompts:
# - Text to decrypt
# - Shift value (1-25)
How it works: Each letter is shifted by a fixed number of positions in the alphabet.
# Encrypt
# Prompts:
# - Text to encrypt
# - Keyword
# Decrypt
# Prompts:
# - Text to decrypt
# - Keyword
How it works: Uses a keyword to shift letters by varying amounts.
# Encrypt
# Prompts:
# - Text to encrypt
# - Keyword for matrix
# Decrypt
# Prompts:
# - Text to decrypt
# - Keyword for matrix
How it works: Encrypts pairs of letters using a 5x5 key matrix.
# Encrypt
# Prompts:
# - Text to encrypt
# - Number of rails (2-10)
# Decrypt
# Prompts:
# - Text to decrypt
# - Number of rails (2-10)
How it works: Text is written in a zigzag pattern across multiple rails.
🔐 Stream & Block Ciphers
# Encrypt
# Prompts:
# - Text to encrypt
# - Key (variable length)
# - Output encoding (base64/hex)
# Decrypt
# Prompts:
# - Text to decrypt
# - Key (same as encryption)
# - Input encoding (base64/hex)
Note: Legacy algorithm, use for educational purposes only.
# Encrypt
# Prompts:
# - Text to encrypt
# - Password
# - Key size (128/192/256)
# - Mode (ECB/CBC)
# - Output encoding (base64/hex)
# Decrypt
# Prompts:
# - Text to decrypt
# - Password (same as encryption)
# - Key size (same as encryption)
# - Mode (same as encryption)
# - Input encoding (same as encryption)
Security: Industry-standard symmetric encryption.
# Encrypt
# Prompts:
# - Text to encrypt
# - Key (exactly 8 characters)
# - Mode (ECB/CBC)
# - Output encoding (base64/hex)
# Decrypt
# Prompts:
# - Text to decrypt
# - Key (same as encryption)
# - Mode (same as encryption)
# - Input encoding (same as encryption)
Note: Legacy algorithm, use for educational purposes only.
🔑 Asymmetric Encryption
# Encrypt
# Prompts:
# - Text to encrypt
# - Key size (512/1024/2048)
# - Output encoding (base64/hex)
# Tool generates key pair automatically
# Decrypt
# Prompts:
# - Text to decrypt
# - Private key (format: n:d)
# - Input encoding (base64/hex)
Use case: Small data encryption and digital signatures.
# Key exchange operations
# Options:
# - Interactive Simulation (Alice & Bob)
# - Manual Exchange - Start Session
# - Manual Exchange - Complete with Other's Key
# - Mathematical Concept Demo
Use case: Secure key exchange demonstration.
🔢 Hash Functions
# Prompts:
# - Text to hash
# Output: 32-character hexadecimal hash
Note: Cryptographically broken, use only for compatibility.
# Prompts:
# - Text to hash
# Output: 40-character hexadecimal hash
Note: Deprecated, use only for legacy compatibility.
# Prompts:
# - Text to hash
# Output: 64-character hexadecimal hash
Recommended: Use for all new applications requiring hashing.
💡 Examples
Classical Cipher Examples
# 🏛️ Caesar cipher example
)
)
# 🏛️ Vigenère cipher example
Modern Encryption Examples
# 🔐 AES encryption example
)
# 🔐 RSA encryption example
)
Hash Function Examples
# 🔢 Hash function examples
Key Exchange Example
# 🔑 Diffie-Hellman key exchange
& )
==========================================
)
)
)
)
)
)
)
)
🧪 Testing
Run Test Suite
# 🧪 Run all tests
# ⚡ Run specific test files
# 🎯 Run specific algorithm tests
Manual Testing
Test each algorithm interactively:
# Check available commands
# Test classical ciphers
# Test stream & block ciphers
# Test asymmetric encryption
# Test hash functions
🔒 Security
⚠️ Important Security Considerations
| ⚠️ Warning | Description |
|---|---|
| 🎓 Educational Use | This tool is designed for learning and experimentation |
| 🚫 Legacy Algorithms | RC4, DES, MD5, and SHA-1 are NOT secure for modern use |
| 🚫 Classical Ciphers | All classical ciphers are NOT secure for real-world use |
| 🔑 Interactive Input | Passwords are entered visibly - use only for testing |
| 🏭 Production Use | Use AES and RSA with proper key management for real applications |
🛡️ Recommended Algorithms
# ✅ Secure for modern use
# ❌ Educational/legacy only
🔐 Key Management Best Practices
- AES: Use strong passwords (12+ characters, mixed case, numbers, symbols)
- DES: Use exactly 8 characters as required by the algorithm
- RSA: Use 2048+ bit keys for real applications (512/1024 for education only)
- RC4: Use random keys of appropriate length
🤝 Contributing
We welcome contributions! Here's how to get started:
🚀 Quick Contribution Guide
- 🍴 Fork the repository
- 🌿 Create a feature branch:
- ✨ Make your changes
- 🧪 Test thoroughly:
- 📝 Commit and create a Pull Request
🎯 Contribution Areas
| Area | Description | Difficulty |
|---|---|---|
| 🔐 New Algorithms | Implement additional ciphers | 🟡 Medium |
| 🎨 CLI Improvements | Better interactive experience | 🟢 Easy |
| 📚 Documentation | Examples and guides | 🟢 Easy |
| 🧪 Testing | More comprehensive tests | 🟡 Medium |
🔧 Development Setup
# Clone and setup
# Install dependencies
# Run tests
# Format code
# Check for issues
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🌟 Show Your Support
If you find ruscrypt useful, please consider:
Created with ❤️ by Adel2411