End-To-End Encrypted Communication using Python
Have you ever wondered how WhatsApp maintains your chats secure to prevent the ‘Man in the Middle’ from viewing them? That’s called ‘End-to-End Encryption’, which encrypts the message before sending using a key, and decrypts the message after the receiver receives it.
Here’s the mini-version of it. I created it for my University project.
Platforms I used:
- Thingspeak (Ignore if you don’t know. It’s ok.)
(ThingSpeak is an open-source IoT cloud to log data from programs and IoT devices and perform Data Analytics.)
Python Packages to be downloaded:
To download these, first install Python. Go to ‘Command Prompt’. Type
pip install <package nameand press Enter.
pip install urllib
Now, here’s the code that sends the message:
Now, type some message and give your own key. The message gets encrypted based on the key, and is sent to the ThingSpeak channel of the access key mentioned in the code.
Observe line 25. When you attach some number or string at the end of the URL, and open it, the data is sent to the cloud.
Encrypted text is shown for your reference.
Important Note: To access ThingSpeak, you need to have a MathWorks account. But in this code, I’m giving my access code. So, you can use it like you don’t need ThingSpeak at all!