e12ba8faf7
·
2026-01-19 00:46:01 +07:00
9 Commits
asscryption
Proof-of-concept random key-based text transformer.
Usage
you can use -o <FILE> to write to file.
Encrypt
python main.py encrypt <filein> <target> [--seed SEED] > keyfile
filein: Input text file (plaintext)target: Target text file (what you want to transform to)--seed: (Optional) Random seed for reproducibilitykeyfile: Output key file (redirect stdout)
Decrypt
python main.py decrypt <filein> <keyfile>
filein: Input text file (should match the input used in encrypt)keyfile: Key file produced during encryption
Output as bytes
For both encryption and decryption, use -b or --bytes to output or read the key as a compact bytearray of N bytes for the index (usize) plus 1 byte (u8) for the offset.
- Use
-bor--bytesalone for the default size (8 bytes for index). - Optionally specify a size after
-b(e.g.-b 4or--bytes=4) to customize the index size in bytes. - Important: When decrypting, you must specify the same byte size as was used for encryption.
Example
encryption:
python main.py encrypt message.txt target.txt --seed 42 > mykey.txt
python main.py encrypt filein.txt target.txt -b > keyfile.bin # 8-byte index (default)
python main.py encrypt filein.txt target.txt -b 4 > keyfile.bin
python main.py encrypt filein.txt target.txt --seed 123 -b=4 > keyfile.bin
decryption:
python main.py decrypt message.txt mykey.txt > reconstructed_target.txt
python main.py decrypt filein.txt keyfile.bin -b 4 > out.txt # must match key size
python main.py decrypt filein.txt keyfile.bin --bytes=4 > out.txt
NOTE: This is a proof-of-concept. The "key" is printed to stdout during encryption. The target file must exist.
Version 1.2
Languages
Python
100%