shield-core
EXPTIME-secure encryption library for Rust - symmetric cryptography with proven exponential-time security.
Why Shield?
Shield uses only symmetric primitives with EXPTIME-hard security guarantees. Breaking requires 2^256 operations - no shortcut exists:
- PBKDF2-SHA256 for key derivation (100,000 iterations)
- SHA256-based stream cipher (AES-256-CTR equivalent)
- HMAC-SHA256 for authentication
Installation
[]
= "0.1"
For WebAssembly:
[]
= { = "0.1", = ["wasm"] }
Quick Start
Basic Encryption
use Shield;
// Password-based encryption
let shield = new;
let encrypted = shield.encrypt?;
let decrypted = shield.decrypt?;
Pre-shared Key
use ;
let key = ; // Your 32-byte key
let encrypted = quick_encrypt?;
let decrypted = quick_decrypt?;
Large File Encryption
use StreamCipher;
let cipher = from_password;
let data = vec!; // 1MB
let encrypted = cipher.encrypt?;
let decrypted = cipher.decrypt?;
Forward Secrecy (Ratchet)
use RatchetSession;
let root_key = ; // Exchanged via secure channel
let mut alice = new;
let mut bob = new;
// Each message uses a new key
let encrypted = alice.encrypt?;
let decrypted = bob.decrypt?;
Features
std(default): Standard library supportcli(default): Command-line interface (shieldbinary)wasm: WebAssembly support via wasm-bindgen
CLI Tool
# Install
# Encrypt/decrypt files
# Check password strength
# Encrypt text directly
# Generate random key
# Show info
Password Strength
use ;
let result = check_password;
println!;
println!; // Strong
println!;
if !result.is_acceptable
API Reference
Shield
Main encryption struct with password-derived keys.
StreamCipher
Streaming encryption for large files.
RatchetSession
Forward secrecy with key ratcheting.
PasswordStrength
Password strength analysis.
Interoperability
Shield produces byte-identical output across all implementations:
- Python:
pip install shield-crypto - Rust:
cargo add shield-core - JavaScript:
npm install @guard8/shield
Security Model
Shield uses only symmetric primitives with unconditional security:
- Symmetric encryption (AES-256 equivalent)
- Hash functions (SHA-256)
- HMAC authentication
- Key derivation (PBKDF2)
Breaking requires 2^256 operations - no shortcut exists.
Safety
This crate uses #![forbid(unsafe_code)] and relies on audited cryptographic libraries:
ringfor PBKDF2, HMAC-SHA256, and random number generationsubtlefor constant-time operations
License
CC0-1.0 (Public Domain) - Use freely, no attribution required.
See Also
- Shield Python Package
- Shield npm Package
- GitHub Repository
- BENCHMARKS.md - Performance comparison vs AES-GCM
- MIGRATION.md - Migration from Fernet, NaCl, etc.