A professional, high-security file encryption utility written in Rust using ChaCha20-Poly1305 authenticated encryption.
- Algorithm: ChaCha20-Poly1305 (AEAD cipher)
- Key Derivation: Argon2 (memory-hard password hashing)
- Nonce: 96-bit random (unique per encryption)
- Salt: 128-bit random (unique per encryption)
- Key Size: 256-bit
- Authentication: Built-in authentication tag to detect tampering
- Rust 1.70 or higher
- Cargo
git clone https://github.com/wignn/crypt
cd Crypt
cargo build --releaseThe compiled binary will be in target/release/crypt.exe (Windows) or target/release/crypt (Unix).
crypt encrypt -i file.txt -o file.enc -k mypasswordcrypt encrypt -i document.pdf -o document.enc -k keyfile.key -fcrypt decrypt -i file.enc -o file.txt -k mypasswordcrypt decrypt -i document.enc -o document.pdf -k keyfile.key -fcrypt generate-key -o my-secret.keyEncrypts a file using ChaCha20-Poly1305 AEAD cipher.
Options:
-i, --input <FILE>- Input file path to encrypt-o, --output <FILE>- Output file path for encrypted data-k, --key <PASSWORD|FILE>- Encryption key (password or file path)-f, --key-file- Use file as key source instead of password
Decrypts a previously encrypted file.
Options:
-i, --input <FILE>- Encrypted file path to decrypt-o, --output <FILE>- Output file path for decrypted data-k, --key <PASSWORD|FILE>- Decryption key (must match encryption key)-f, --key-file- Use file as key source instead of password
Generates a random 256-bit cryptographic key file.
Options:
-o, --output <FILE>- Output path for the generated key file
- Use Strong Passwords: Minimum 12 characters with mixed case, numbers, and symbols
- Key Files: For sensitive data, use key files instead of passwords
- Secure Storage: Store keys and passwords securely - they cannot be recovered if lost
- Verify Decryption: Always verify the decrypted file to ensure integrity
- Unique Keys: Use different keys for different purposes
Run the test suite:
cargo testRun tests with output:
cargo test -- --nocaptureEncrypted files have the following structure:
[SALT (16 bytes)][NONCE (12 bytes)][CIPHERTEXT + AUTH_TAG]
- Salt: Used for key derivation with Argon2
- Nonce: Ensures each encryption is unique (never reused)
- Ciphertext: The encrypted data
- Auth Tag: 128-bit authentication tag (prevents tampering)
This tool is provided as-is for educational and personal use. Always backup important data before encryption. The authors are not responsible for data loss.