This project provides a simple Python script to encode and decode messages using a custom encoding scheme. The script adds random characters as a prefix and suffix to words with three or more letters, while reversing shorter words for added obfuscation.
- Encoding: Adds random 3-character prefixes and suffixes to words while shifting the first letter to the end.
- Decoding: Removes the added random characters and restores the original word order.
- Supports special characters, spaces, and numbers.
- User-friendly CLI-based interaction.
- Words shorter than 3 characters are reversed.
- Words longer than 3 characters:
- A random 3-character prefix is added.
- The first letter moves to the end.
- A random 3-character suffix is added.
- Words shorter than 3 characters are reversed back.
- For longer words:
- The 3-character prefix and suffix are removed.
- The last letter moves back to the beginning.
- Clone this repository:
git clone https://github.com/yourusername/encode-decode-python.git
- Navigate to the directory:
cd encode-decode-python
- Run the script:
python encode-decode.py
- Enter a message when prompted.
- Choose
E
to encode orD
to decode. - View the result in the terminal.
Enter your message to encode or decode: hello world
write 'E' if you want to encode and 'D' if you want to decode: E
Encoded message is: xYZellohABC pqRorldmNO
Enter your message to encode or decode: xYZellohABC pqRorldmNO
write 'E' if you want to encode and 'D' if you want to decode: D
Decoded message is: hello world
- Punctuation and special characters remain unchanged but may affect word splitting.
- Extra spaces are preserved in output.
- Already encoded messages should not be encoded again, or they might become unrecoverable.
Feel free to fork this project and submit pull requests for improvements or bug fixes.
This project is open-source and available under the MIT License.