gencrypt
gencrypt is a tool for the paranoid used in encrypting, obfuscating, and compressing as well as decrypting arbitrary text or files using a password.
It combines:
- Key derivation with PBKDF2-HMAC-SHA256 (600,000 iterations)
- A custom byte-masking step
- Compression with zstd
- Authenticated encryption using AES‑256‑GCM
- URL-safe, no-padding Base64 for transport
You can use it as:
- A CLI application to encrypt/decrypt text and files
- A Rust library to call
encode_custom/decode_customfrom your own code
Installation
From crates.io (recommended)
If you have a working Rust toolchain with Cargo installed:
This will download, build, and place the gencrypt binary in ~/.cargo/bin.
Make sure that directory is on your PATH.
Confirm installation:
From source
-
Clone the repository:
-
Build in release mode:
-
The compiled binary will be at:
target/release/gencryptYou can run it directly or copy/symlink it somewhere on your
PATH.
Using as a library
Add gencrypt as a dependency in Cargo.toml:
[]
= "0.1"
Then, in your Rust code:
use ;
For binary-safe usage (arbitrary bytes instead of UTF‑8 strings), use the *_bytes APIs:
use ;
How it works (high level)
The main logic lives in crypto.rs and is used by the UI code in main.rs.
Given an input and a password:
- A random salt and nonce are generated.
derive_keys(password, salt)uses PBKDF2‑HMAC‑SHA256 to produce:- A small set of bytes for the custom masking step
- A 32‑byte AES‑256 key
- The input bytes are masked with a rolling
mixvalue for an extra obfuscation layer. - The masked bytes are compressed with zstd (level 3).
- The compressed data is encrypted using AES‑256‑GCM with the derived key and random nonce.
- The result is:
salt || nonce || ciphertext, encoded with URL-safe Base64 (no padding).
Decoding reverses these steps, verifying the AES‑GCM tag to ensure integrity and authenticity before attempting decompression or unmasking.
Building / Running Tests
To build (debug):
To run tests:
Security notes
- The password is stretched with PBKDF2-HMAC-SHA256 using 600,000 iterations, which is intentionally slow to hinder brute-force attacks.
- Encryption uses AES‑256‑GCM, providing confidentiality and integrity.
- Nevertheless, do not treat this as a substitute for a fully reviewed, widely used cryptographic standard or protocol.
- Always keep your passwords secret and avoid reusing them across different systems.
Use at your own risk and verify that it meets your security requirements before using it for sensitive data.