| Crates.io | gencrypt |
| lib.rs | gencrypt |
| version | 0.10.0 |
| created_at | 2025-05-23 05:38:50.189576+00 |
| updated_at | 2025-12-10 09:29:15.806425+00 |
| description | Personal usage hashing utility. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1685916 |
| size | 152,578 |
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:
You can use it as:
A CLI application to encrypt/decrypt text and files
A Rust library to call encode_custom / decode_custom from your own code
If you have a working Rust toolchain with Cargo installed:
cargo install gencrypt
This will download, build, and place the gencrypt binary in ~/.cargo/bin.
Make sure that directory is on your PATH.
Confirm installation:
gencrypt --help
Clone the repository:
git clone https://github.com/<your-username>/gencrypt.git
cd gencrypt
Build in release mode:
cargo build --release
The compiled binary will be at:
target/release/gencrypt
You can run it directly or copy/symlink it somewhere on your PATH.
Add gencrypt as a dependency in Cargo.toml:
[dependencies]
gencrypt = "0.1"
Then, in your Rust code:
use gencrypt::crypto::{encode_custom, decode_custom};
fn main() -> Result<(), String> {
let password = "correct horse battery staple";
let plaintext = "Hello, world!";
// Encrypt
let ciphertext = encode_custom(plaintext, password);
println!("Ciphertext: {ciphertext}");
// Decrypt
let recovered = decode_custom(&ciphertext, password)?;
println!("Recovered: {recovered}");
Ok(())
}
For binary-safe usage (arbitrary bytes instead of UTF‑8 strings), use the *_bytes APIs:
use gencrypt::crypto::{encode_custom_bytes, decode_custom_bytes};
fn roundtrip_bytes() -> Result<(), String> {
let password = "secret";
let data = b"\x00\xffbinary data\x01";
let encoded = encode_custom_bytes(data, password);
let decoded = decode_custom_bytes(&encoded, password)?;
assert_eq!(decoded, data);
Ok(())
}
The main logic lives in crypto.rs and is used by the UI code in main.rs.
Given an input and a password:
derive_keys(password, salt) uses PBKDF2‑HMAC‑SHA256 to produce:
mix value for an extra obfuscation layer.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.
To build (debug):
cargo build
To run tests:
cargo test
Use at your own risk and verify that it meets your security requirements before using it for sensitive data.