MegaCrypt is a high-performance cryptographic SDK written in Rust and designed for secure application infrastructure.
It provides a unified encryption layer across:
- Native Rust applications
- Backend services
- Node.js environments
- Browser applications through WebAssembly
- Cross-platform secure communication systems
MegaCrypt focuses on:
- authenticated encryption
- secure key derivation
- encrypted packet transport
- portable cryptographic workflows
- memory-safe implementation
The project is designed for applications requiring strong confidentiality guarantees, including:
- secure messaging platforms
- encrypted APIs
- file protection systems
- WebRTC signaling layers
- confidential application data pipelines
MegaCrypt follows a zero-trust encryption architecture.
The library does not implement custom cryptographic algorithms. Instead, it combines established cryptographic primitives through controlled APIs.
| Component | Algorithm | Purpose |
|---|---|---|
| Authenticated Encryption | ChaCha20-Poly1305 | Encrypt and authenticate application data |
| Password Key Derivation | Argon2id | Derive encryption keys from user secrets |
| Hash Derivation | BLAKE3 | Fast cryptographic hashing and key derivation |
| Random Generation | OS CSPRNG | Secure nonce and salt generation |
Application Layer
┌─────────────────────────────────┐
│ Chat • API • Storage • Media │
└───────────────┬─────────────────┘
│
┌───────────────┴─────────────────┐
│ MegaCrypt API │
│ │
│ Rust API WASM API │
└───────────────┬─────────────────┘
│
┌───────────────┴─────────────────┐
│ Crypto Engine │
│ │
│ Key Management │
│ Encryption Contexts │
│ Packet Processing │
└───────────────┬─────────────────┘
│
┌───────────────┴─────────────────┐
│ ChaCha20-Poly1305 AEAD │
└─────────────────────────────────┘
- Authenticated encryption
- Secure key derivation
- Random nonce generation
- Tamper detection
- Portable encrypted packets
- Zero-cost abstractions
- Memory safety guarantees
- Async-compatible integration
- Server-side deployment support
- WebAssembly bindings
- Node.js compatibility
- TypeScript definitions
- Browser-ready encryption APIs
Add MegaCrypt to your Cargo.toml:
[dependencies]
megacrypt = "1.0.0"Then:
cargo buildInstall using npm:
npm install megacryptor:
pnpm add megacryptuse megacrypt::{ CryptoEngine, derive_password_key };
use megacrypt::api::ApiCrypto;
use megacrypt::types::Salt;
use megacrypt::kdf::KdfParams;
fn main() {
// 1. Create a valid 16-byte salt type
let salt = Salt::new(*b"megacryptsalt16b");
// 2. Supply the missing KdfParams argument (using default parameters)
let key = derive_password_key(b"password", &salt, KdfParams::default()).expect(
"Failed to derive password key"
);
let engine = CryptoEngine::new(key);
let message = b"confidential message";
// 3. Encrypt and wrap using the API layer
let packet = ApiCrypto::encrypt_request(&engine, message);
// This is what you send to frontend / API
println!("WEB RESPONSE: {}", packet.data);
// 4. Decrypt back
let decrypted = ApiCrypto::decrypt_request(&engine, packet);
println!("DECRYPTED: {}", String::from_utf8_lossy(&decrypted));
}import { WasmApiCrypto } from "megacrypt";
const crypto = new WasmApiCrypto("application-secret");
const encoder = new TextEncoder();
const payload = encoder.encode("confidential message");
const encrypted = crypto.encrypt_request(payload);
console.log(encrypted);
const decrypted = crypto.decrypt_request(encrypted);
console.log(new TextDecoder().decode(decrypted));