weecrypt is a simple file encryptor written in Rust. It uses the AES-GCM algorithm to securely encrypt files and stores them in a custom .wee file format. This project is intended for learning purposes and demonstrates how to implement file encryption, custom file headers, and basic cryptographic operations in Rust.
- Encrypt any file into a
.weefile with a custom header - Decrypt
.weefiles back to their original form - Stores metadata such as file extension, encryption version, nonce, and original filename in the file header
- Command-line interface (CLI) ready structure
- Includes benchmarks and tests
A .wee file consists of:
- Plain Header (unencrypted):
- File extension (
wee) - Version of weecrypt used
- Nonce used for encryption
- File extension (
- Hidden Header (encrypted):
- Original file name length and name
- Encrypted Content: The file's data, encrypted with AES-GCM
use weecrypt::core::encrypt;
let key = [0u8; 32]; // Use a secure key in production!
let input = std::path::Path::new("myfile.txt");
let output = std::path::Path::new("myfile.wee");
encrypt(input, output, &key)?;use weecrypt::core::decrypt;
let key = [0u8; 32];
let input = std::path::Path::new("myfile.wee");
let output_dir = std::path::Path::new("./decrypted/");
decrypt(input, output_dir, &key)?;See src/example/plain_header_example.rs for a minimal example of writing and reading a plain header.
cargo testcargo benchsrc/core.rs: Encryption and decryption logicsrc/models/: File header structures and versioningsrc/example/: Example code for using headersbenches/: Benchmarks for header operationstests/: Integration tests
This project is for educational purposes only. Do not use it for securing sensitive data in production environments.