Skip to content

About

Python script that encodes and decodes text messages.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Python Message Encoder / Decoder (DataCrypter)

A small desktop app built with Tkinter that encodes and decodes text messages using a shared key. Type a message, a key and a mode, and press RESULT. The same key must be used to decode a message that was encoded.

The goal of the project is to encode and decode messages using a common key, using the Tkinter and base64 modules from the Python standard library.

Note: this is a simple key-based obfuscation technique for learning purposes. It is not strong encryption and should not be used to protect sensitive information.

Features

  • Encode a message with a key and get a URL-safe Base64 string
  • Decode that string back to the original message with the same key
  • Simple Tkinter window with MESSAGE, KEY and MODE fields, and RESULT, RESET and EXIT buttons
  • Friendly messages for an invalid mode, a missing key, or text that cannot be decoded
  • No third-party dependencies

How it works

  • Encode: each character of the message is shifted by the matching character of the key (the key repeats as needed): (ord(message_char) + ord(key_char)) % 256. The resulting text is encoded as URL-safe Base64.
  • Decode: the Base64 text is decoded and the shift is reversed with the same key.

Because the shift is taken modulo 256, characters outside the Latin-1 range (code points above 255) will not survive an encode/decode round trip.

Tech stack

  • Python 3
  • Tkinter (GUI) and base64 (both in the standard library)

Setup

git clone https://github.com/digantadatta/Python-Message-Encoder-Decorder.git
cd Python-Message-Encoder-Decorder

No packages need to be installed (see requirements.txt). Tkinter is bundled with the official Python installers for Windows and macOS; on Debian/Ubuntu install it with sudo apt install python3-tk.

Run

python MessageEncodeDecode.py

Usage example

  1. Enter Hello World in MESSAGE, mykey in KEY, and e in MODE, then press RESULT. The result field shows wrXDnsOXw5HDqMKNw5DDmsOXw6XDkQ==.
  2. To decode, paste that result into MESSAGE, keep the key mykey, set MODE to d, and press RESULT. The result field shows Hello World.
  3. RESET clears all fields; EXIT closes the window.

You can also use the functions from Python:

from MessageEncodeDecode import Encode, Decode

token = Encode("mykey", "Hello World")
print(Decode("mykey", token))  # Hello World

Project structure

.
├── MessageEncodeDecode.py   # Encode/Decode functions and the Tkinter UI
├── requirements.txt         # No third-party dependencies
├── LICENSE
└── .github/workflows/ci.yml # CI: compile and flake8

License

Released under the MIT License.

About

Python script that encodes and decodes text messages.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages