Skip to main content

TDE โ€” Tanishq's Decoder & Encoder. A fast, dependency-free Base64 CLI tool.

Project description

Version Python License Dependencies Platform

๐Ÿ” 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

โš ๏ธ --strict and --ignore-garbage are 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/awesome-feature)
  3. Commit your changes (git commit -m "Add awesome feature")
  4. Push to the branch (git push origin feature/awesome-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tde-1.0.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tde-1.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

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

Hashes for tde-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f2b9fbc2adbbda0e4de606cbd6b6fbdca153e5ad8599e137f01adc249b959c0f
MD5 0c74ab4edaa89697338a99603fb92690
BLAKE2b-256 2394890ee3044f3e64d9e01b851a530cb3919c33b6d188bfa1b92b889c745718

See more details on using hashes here.

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

Hashes for tde-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9605f14e8d7e5a2ad39925efdb86a3063351c2536c75f2d95408eaee64dde93a
MD5 c258c7705bcfd359feb34154499827eb
BLAKE2b-256 3648dd466805de6452edc09ff34ed957c9c7696fac32b9c718c5066b32fc9fa5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page