TDE โ Tanishq's Decoder & Encoder. A fast, dependency-free Base64 CLI tool.
Project description
๐ TDE โ Tanishq's Decoder & Encoder
A fast, lightweight, dependency-free CLI tool for Base64 encoding & decoding.
Built purely with Python's standard libraries โ zero security overhead, absolute portability.
Features โข Installation โข Usage โข Architecture โข Contributing โข License
โจ Features
| Feature | Description |
|---|---|
| ๐ซ 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 |
| ๐งน 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
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.0.0
๐ Usage
Basic Encoding & Decoding
# Encode a string to Base64
tde encode "hello world"
# Output: aGVsbG8gd29ybGQ=
# Decode a Base64 string
tde decode "aGVsbG8gd29ybGQ="
# 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
๐ก๏ธ Strict Mode (--strict)
Forces the tool to halt immediately with a clear error if the input contains any non-Base64 characters.
tde decode "aGVsbG8gd2!9ybGQ=" --strict
# Error: Strict mode: invalid Base64 character(s) found: '!'
# Hint: use --ignore-garbage to strip them automatically.
๐งน 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
๐ 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
๐ Full Help Menu
tde --help
+========================================+
| TDE -- The Data Encoder / Decoder |
| v1.0.0 | Zero-dependency Base64 |
+========================================+
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.
Advanced modifiers:
--url Use URL-safe Base64 alphabet (- _ instead of + /).
--strict Halt with an error on any non-Base64 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 โ โ
โ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโฌโโโโโ โโโโโโโโโโฌโโโโโโโโโ โ
โโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ โ โ โ
โผ โผ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ 2. INPUT ROUTER โ โ โ
โ Priority Hierarchy: โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ
โ โ 1. File (-i flag) โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโ โ
โ โ 2. Stdin (piped) โ โ โ
โ โ 3. Arg (inline) โ โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3. PROCESSING CORE โ
โ โ
โ โโ ENCODE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ input bytes โโโบ b64encode() โโโบ result โ โ
โ โ --url? โโโบ urlsafe_b64encode() โโโบ strip '=' pad โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโ DECODE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ --strict? โโโบ regex validate โโโบ halt on bad โ โ
โ โ --ignore-garbage? โโโบ regex strip junk chars โ โ
โ โ --url? โโโบ restore padding โโโบ urlsafe_b64 โ โ
โ โ (default) โโโบ b64decode() โโโบ result โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 4. OUTPUT ROUTER โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ -o flag set? โโโบ Write bytes to file โ โ
โ โ (default) โโโบ Print to stdout โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Data Flow
User Input โโโบ Argument Parser โโโบ Input Router โโโบ Processing Core โโโบ Output Router
โ โ โ โ
Parse command Read from: Apply flags: Deliver to:
& flags โข File (-i) โข --url โข File (-o)
โข Stdin (pipe) โข --strict โข Stdout
โข Inline arg โข --ignore-garbage
Module Structure
TDE-Tool/
โโโ .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.0.0")
โโโ cli.py # Complete CLI implementation
# โโโ ANSI colour helpers
# โโโ Banner & help formatter
# โโโ _acquire_input() โ Input Router
# โโโ _encode() โ Encoding engine
# โโโ _decode() โ Decoding engine
# โโโ _emit() โ Output Router
# โโโ main() โ Entry point
๐ง CLI Reference
| Argument | Type | Description |
|---|---|---|
encode |
Command | Convert input to Base64 |
decode |
Command | Convert Base64 back to original |
<data> |
Positional | Inline string payload |
-i, --input |
Flag | Read payload from a file |
-o, --output |
Flag | Write result to a file |
-v, --version |
Flag | Show version (TDE v1.0.0) |
-h, --help |
Flag | Show help menu with examples |
--url |
Modifier | Use URL-safe Base64 alphabet |
--strict |
Modifier | Error on invalid characters |
--ignore-garbage |
Modifier | Strip invalid characters before decoding |
โ ๏ธ
--strictand--ignore-garbageare mutually exclusive โ they cannot be used together.
๐ฏ 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 |
๐ค 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.0.0.tar.gz.
File metadata
- Download URL: tde-1.0.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2b9fbc2adbbda0e4de606cbd6b6fbdca153e5ad8599e137f01adc249b959c0f
|
|
| MD5 |
0c74ab4edaa89697338a99603fb92690
|
|
| BLAKE2b-256 |
2394890ee3044f3e64d9e01b851a530cb3919c33b6d188bfa1b92b889c745718
|
File details
Details for the file tde-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tde-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.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 |
9605f14e8d7e5a2ad39925efdb86a3063351c2536c75f2d95408eaee64dde93a
|
|
| MD5 |
c258c7705bcfd359feb34154499827eb
|
|
| BLAKE2b-256 |
3648dd466805de6452edc09ff34ed957c9c7696fac32b9c718c5066b32fc9fa5
|