Coders Packet

Secret Message Encoder using Python

By Archisman Bhattacharya

This is a very basic python code for encoding a given message by using a random key generated during execution. This code can generate up to 321,272,380 different keys.

Version and Module Used:

Python 3

Random module

Math module


This is a very basic message encoder using python. It takes a message from the user and then encodes it using a key and a value.

The key is generated at run time and is different for every execution. This is achieved by using the random module in python. The code first determines the length of the key and then starts generating the key by selecting random characters from a list of alphabets. The key is then passed onto the main encoder.

The code then generates a random value which shall be used to encode the final message. Then the code determines the positions in the message where the generated key will be inserted. This is again done randomly during runtime. The code then adds the key at the determined locations.

Then we encode the obtained message using the value generated. At the end of the message, the key for the given message and the value is added and the final message is generated and displayed to the user. We also encode the key at the end so that the actual key or value is never revealed. 

This can be a really fun way to send messages without others realizing it.


Run the above code in python IDLE as some of the characters generated by the encoding function are not supported by the command prompt and thus they won't be rendered correctly.


Download Complete Code


No comments yet