TDE โ Tanishq's Decoder & Encoder. A fast, dependency-free multi-format encoding CLI tool (Base64, Hex, Base32, Base85).
Project description
๐ TDE โ Tanishq's Decoder & Encoder
A fast, lightweight, dependency-free CLI tool for multi-format encoding & decoding.
Supports Base64, Hex, Base32, and Base85 โ built purely with Python's standard libraries.
Features โข Installation โข Usage โข Formats โข Architecture โข Contributing โข License
โจ Features
| Feature | Description |
|---|---|
| ๐ Multi-Format Encoding | Supports Base64, Hex, Base32, and Base85 encoding/decoding out of the box |
| ๐ซ Zero Dependencies | Runs natively using only built-in Python libraries โ nothing to install, nothing to break |
| ๐ฅ๏ธ Cross-Platform | Works seamlessly on Command Prompt, PowerShell, Git Bash, WSL, and Linux/macOS terminals |
| ๐ File I/O | Read from and write directly to files for handling large payloads or binaries |
| ๐ URL-Safe Mode | Seamlessly handle JSON Web Tokens (JWTs) and URL parameters with - _ alphabet |
| ๐ก๏ธ Strict Validation | Catch malformed data streams instantly with --strict mode (all formats) |
| ๐งน Garbage Collection | Force-decode messy inputs by stripping invalid characters automatically |
| ๐ Pipe Support | Chain with other CLI tools via stdin/stdout piping |
| ๐จ Coloured Output | ANSI colour support with automatic graceful degradation |
๐ฆ Installation
Prerequisites: Python 3.7 or higher
Quick Install
pip install tde
Or
git clone https://github.com/tanishqzope/TDE-Tool.git
cd TDE-Tool
pip install .
Once installed, the tde command is globally available from any terminal.
Verify Installation
tde --version
# Output: TDE v1.1.0
๐ฏ Supported Formats
| Format | Flag | Alphabet | Use Case |
|---|---|---|---|
| Base64 | --format base64 (default) |
A-Z a-z 0-9 + / |
General-purpose encoding, email, MIME |
| Hex | --format hex |
0-9 a-f |
Byte-level inspection, checksums, crypto |
| Base32 | --format base32 |
A-Z 2-7 |
Case-insensitive contexts, OTP secrets |
| Base85 | --format base85 |
ASCII 33โ117 | Maximum density, PDF internals |
Shorthand: Use
-finstead of--formatfor brevity โ e.g.,tde encode "data" -f hex
๐ Usage
Basic Encoding & Decoding (Base64 โ default)
# Encode a string to Base64
tde encode "hello world"
# Output: aGVsbG8gd29ybGQ=
# Decode a Base64 string
tde decode "aGVsbG8gd29ybGQ="
# Output: hello world
๐ข Hex Encoding
# Encode to hexadecimal
tde encode "hello world" --format hex
# Output: 68656c6c6f20776f726c64
# Decode from hex
tde decode "68656c6c6f20776f726c64" --format hex
# Output: hello world
๐ค Base32 Encoding
# Encode to Base32
tde encode "hello world" --format base32
# Output: NBSWY3DPEB3W64TMMQ======
# Decode from Base32
tde decode "NBSWY3DPEB3W64TMMQ======" --format base32
# Output: hello world
๐ฆ Base85 Encoding
# Encode to Base85 (Ascii85)
tde encode "hello world" --format base85
# Output: Xk~0{Zv
# Decode from Base85
tde decode "Xk~0{Zv" --format base85
# Output: hello world
๐ URL-Safe Mode (--url)
Generate Base64 strings safe for web transit โ replaces +// with -/_ and strips = padding. Perfect for JWTs and URL parameters.
tde encode "https://example.com/api?token=abc" --url
# Output: aHR0cHM6Ly9leGFtcGxlLmNvbS9hcGk_dG9rZW49YWJj
โ ๏ธ
--urlonly applies to--format base64(the default).
๐ก๏ธ Strict Mode (--strict)
Forces the tool to halt immediately with a clear error if the input contains any invalid characters for the selected format.
# Strict Base64 decode
tde decode "aGVsbG8gd2!9ybGQ=" --strict
# Error: Strict mode: invalid Base64 character(s) found: '!'
# Strict Hex decode
tde decode "68656c6c6fZZ" --format hex --strict
# Error: Strict mode: invalid hex character(s) found: 'Z'
๐งน Ignore Garbage (--ignore-garbage)
Strips whitespace, newlines, and invalid characters before decoding โ perfect for messy copy-paste inputs.
tde decode "aGVsbG8 gd 29ybGQ=" --ignore-garbage
# Output: hello world
๐ File Operations
Read a payload from a file and write the decoded output to a new file:
# Encode a file's contents
tde encode -i secret.txt -o encoded_payload.txt
# Decode back to original
tde decode -i encoded_payload.txt -o original.txt
# Hex-encode a binary file
tde encode -i image.png -o image_hex.txt --format hex
๐ Piping Support
Chain TDE with other CLI tools:
# Pipe from echo
echo "sensitive data" | tde encode
# Chain with curl
curl -s https://api.example.com/data | tde decode
# Pipe between TDE commands (round-trip)
echo "hello" | tde encode | tde decode
# Round-trip hex verification
echo "hello" | tde encode -f hex | tde decode -f hex
๐ Full Help Menu
tde --help
+========================================+
| TDE -- The Data Encoder / Decoder |
| v1.1.0 | Multi-format Encoder |
+========================================+
positional arguments:
{encode,decode} Operation to perform: 'encode' or 'decode'.
data Inline string payload (optional if using -i or stdin).
I/O options:
-i, --input FILE Read payload from FILE instead of stdin/args.
-o, --output FILE Write result to FILE instead of stdout.
Encoding format:
-f, --format FMT Encoding format: base64 (default), hex, base32, base85.
Advanced modifiers:
--url Use URL-safe Base64 alphabet (- _ instead of + /).
--strict Halt with an error on any invalid character.
--ignore-garbage Strip whitespace and invalid characters before decoding.
๐๏ธ Architecture
High-Level Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ tde <command> [data] [flags] โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. ARGUMENT PARSER (argparse) โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ command โ โ data โ โ flags โ โ I/O options โ โ
โ โencode/ โ โ(inline) โ โ--url โ โ -i input file โ โ
โ โdecode โ โ โ โ--strictโ โ -o output file โ โ
โ โ โ โ โ โ-f fmt โ โ โ โ
โ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโฌโโโโโ โโโโโโโโโโฌโโโโโโโโโ โ
โโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ โ โ โ
โผ โผ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ 2. INPUT ROUTER โ โ โ
โ Priority Hierarchy: โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ
โ โ 1. File (-i flag) โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโ โ
โ โ 2. Stdin (piped) โ โ โ
โ โ 3. Arg (inline) โ โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3. FORMAT DISPATCHER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ -f base64 (default) โโโบ Base64 encode/decode engine โ โ
โ โ -f hex โโโบ Hex encode/decode engine โ โ
โ โ -f base32 โโโบ Base32 encode/decode engine โ โ
โ โ -f base85 โโโบ Base85 encode/decode engine โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโ ENCODE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ base64: b64encode() / urlsafe_b64encode() โ โ
โ โ hex: binascii.hexlify() โ โ
โ โ base32: b32encode() โ โ
โ โ base85: b85encode() โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโ DECODE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ --strict? โโโบ regex validate per format โ โ
โ โ --ignore-garbage? โโโบ regex strip invalid chars โ โ
โ โ base64: b64decode() / urlsafe_b64decode() โ โ
โ โ hex: binascii.unhexlify() โ โ
โ โ base32: b32decode() โ โ
โ โ base85: b85decode() โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 4. OUTPUT ROUTER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ -o flag set? โโโบ Write bytes to file โ โ
โ โ (default) โโโบ Print to stdout โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Data Flow
User Input โโโบ Argument Parser โโโบ Input Router โโโบ Format Dispatcher โโโบ Output Router
โ โ โ โ
Parse command Read from: Apply format: Deliver to:
& flags โข File (-i) โข base64 (default) โข File (-o)
โข Stdin (pipe) โข hex โข Stdout
โข Inline arg โข base32
โข base85
+ modifiers:
--url --strict
--ignore-garbage
Module Structure
TDE-Tool/
โโโ .github/
โ โโโ workflows/
โ โโโ publish.yml # PyPI auto-publish on release
โโโ .gitignore # Git ignore rules
โโโ LICENSE # MIT License
โโโ README.md # This file
โโโ setup.py # Installer with console_scripts entry point
โโโ tde/ # Main package
โโโ __init__.py # Version constant (__version__ = "1.1.0")
โโโ cli.py # Complete CLI implementation
# โโโ ANSI colour helpers
# โโโ Banner & help formatter
# โโโ _acquire_input() โ Input Router
# โโโ _encode_base64() โ Base64 encoder
# โโโ _encode_hex() โ Hex encoder
# โโโ _encode_base32() โ Base32 encoder
# โโโ _encode_base85() โ Base85 encoder
# โโโ _encode() โ Format dispatcher (encode)
# โโโ _decode_base64() โ Base64 decoder
# โโโ _decode_hex() โ Hex decoder
# โโโ _decode_base32() โ Base32 decoder
# โโโ _decode_base85() โ Base85 decoder
# โโโ _decode() โ Format dispatcher (decode)
# โโโ _emit() โ Output Router
# โโโ main() โ Entry point
๐ง CLI Reference
| Argument | Type | Description |
|---|---|---|
encode |
Command | Convert input using the selected format |
decode |
Command | Decode encoded data back to original |
<data> |
Positional | Inline string payload |
-i, --input |
Flag | Read payload from a file |
-o, --output |
Flag | Write result to a file |
-f, --format |
Option | Encoding format: base64 (default), hex, base32, base85 |
-v, --version |
Flag | Show version (TDE v1.1.0) |
-h, --help |
Flag | Show help menu with examples |
--url |
Modifier | Use URL-safe Base64 alphabet (Base64 only) |
--strict |
Modifier | Error on invalid characters (all formats) |
--ignore-garbage |
Modifier | Strip invalid characters before decoding |
โ ๏ธ
--strictand--ignore-garbageare mutually exclusive โ they cannot be used together.
โ ๏ธ
--urlonly applies to--format base64.
๐ฏ Use Cases
| Scenario | Command |
|---|---|
| ๐ Encode API keys for config files | tde encode "sk-abc123secret" |
| ๐ Generate URL-safe JWT tokens | tde encode "payload" --url |
| ๐ง Decode email attachments | tde decode -i attachment.b64 -o file.pdf |
| ๐งช Validate Base64 integrity | tde decode "data..." --strict |
| ๐ Clean up messy copy-paste | tde decode "broken data" --ignore-garbage |
| ๐ Round-trip verification | echo "test" | tde encode | tde decode |
| ๐ Inspect binary as hex | tde encode -i binary.dat -f hex |
| ๐ Encode OTP secrets (Base32) | tde encode "secret" -f base32 |
| ๐ Compact binary (Base85) | tde encode -i data.bin -f base85 |
| ๐ข Hex round-trip | echo "test" | tde encode -f hex | tde decode -f hex |
๐ Changelog
v1.1.0 โ Multi-Format Encoding
- New: Added
--format/-fflag with support forhex,base32, andbase85encoding - New: Per-format strict validation and garbage stripping
- New: Dedicated encode/decode engines for each format
- Improved: Banner updated to reflect multi-format capability
- Improved: Help text with examples for all formats
- Backwards-compatible: Default format remains
base64; all existing commands work unchanged
v1.0.0 โ Initial Release
- Base64 encoding & decoding
- URL-safe mode (
--url) - Strict validation (
--strict) - Garbage stripping (
--ignore-garbage) - File I/O (
-i,-o) - Pipe support (stdin/stdout)
- ANSI coloured output
๐ค Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/awesome-feature) - Commit your changes (
git commit -m "Add awesome feature") - Push to the branch (
git push origin feature/awesome-feature) - Open a Pull Request
Guidelines
- Use only Python standard library โ no external dependencies
- Maintain cross-platform compatibility
- Add comments for complex logic
- Test on both Windows and Linux/macOS
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
๐ค Author
Tanishq Zope โ @tanishqzope
Built with โค๏ธ and pure Python. No dependencies were harmed in the making of this tool.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tde-1.1.0.tar.gz.
File metadata
- Download URL: tde-1.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5615d76d0b7e0624e32e9fdcc7a49db45f057a80421828fc310745fcace0826
|
|
| MD5 |
1c86187bd75f88fa4a3da21b3d538a42
|
|
| BLAKE2b-256 |
fb49931bfdeccb4bce0a7158c43cdec6f8be8fa8fdbae462f071575d9a11cfcc
|
File details
Details for the file tde-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tde-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9678d8c4c2cc3c125fde5da86faea87d35544df13ab59fdd9501b030ea8fc44e
|
|
| MD5 |
c406b35c0b6aaa20fb8e27232826f7e8
|
|
| BLAKE2b-256 |
4dd8f2b90fe2cc02e109164a9e9952b3c218e2ffecf45e933f7e677b80acea10
|