Skip to content

maxider/weecrypt

Repository files navigation

weecrypt

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.

Features

  • Encrypt any file into a .wee file with a custom header
  • Decrypt .wee files 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

File Format

A .wee file consists of:

  • Plain Header (unencrypted):
    • File extension (wee)
    • Version of weecrypt used
    • Nonce used for encryption
  • Hidden Header (encrypted):
    • Original file name length and name
  • Encrypted Content: The file's data, encrypted with AES-GCM

Usage

Encrypt a File

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)?;

Decrypt a File

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)?;

Example

See src/example/plain_header_example.rs for a minimal example of writing and reading a plain header.

Running Tests

cargo test

Running Benchmarks

cargo bench

Project Structure

  • src/core.rs: Encryption and decryption logic
  • src/models/: File header structures and versioning
  • src/example/: Example code for using headers
  • benches/: Benchmarks for header operations
  • tests/: Integration tests

Security Notice

This project is for educational purposes only. Do not use it for securing sensitive data in production environments.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages