A project for people who like to know how things work! This project represents a basic implementation of the Text-to-Image encryption algorithm. Core concept of this algorithm is to create RGB values for every printable. The Diffie–Hellman key exchange algorithm was used to exchange public keys between the clinet and the server.
Cool thing about this project is that the whole backend is being written from a scratch without using any popular frameworks like Flask or Django. This exeperience helps to understand better the underlying processes of any web-framework.
To run the project on your PC you need:
- Download the GIT repository.
- Create the virtual environmnet in the main repository:
$ python -m venv myvenv
- Activate virtual environmnet
Unix:
$ source myvenv/bin/activate
Windows:
$ .\myvenv\Scripts\activate
- Install al the packages from the requirement.txt
$ pip install -r requirements.txt
- Now you need to run the server, by using the driver file in the main repository
$ python server_driver.py
- The last step is going to be to navigate to the: 'http://127.0.0.1:5050/index'
The key idea of this projects is to encode a text message into an image. In our case we encode text into .png image and send it through the network in base64 format.
Below you can find 3 main states of a message:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAKCAYAAAAzSFWlAAAAAXNSR0IArs4c6QAAAMpJREFUWEdj1K85/5+BCCD+8RcRqhgYfDxKiFJHrKIXqZ+IUnr0LS9R6r4lTidKndq2MqLUZawpJkpd0wVWotSJtXQQpe61fwNR6ohVxD43kyil+YzExcejRT5Emcc4mgCxh9NoAsQeLqMJEEe+Gi0BiSpwcCoaLQFxBM1oFYw9YEarYBwJZrQNiD1gRtuA2MNltA2IIyONtgFH24DgEBitgkerYHAIjA7DYE8Io8Mw2MNldBgGR9U6Og6IPWBGe8GjvWBwCIy0gWgAPezjT7CiZnUAAAAASUVORK5CYII=
To encrypt the previous message we used the private key that was generated on both sides: client and server.
Here is the graphical representation of the private key:
- Router class
- key exchange endpoint
- seed exchange endpoint
- add error handling for endpoints
- map creation endpoint
- add resource path to the settings.py
- modify exception handling in request_handler.py
- char-map initialization
- handle requests for JS, CSS, and other http
- fix http request parser (limited amount of chars)
- fix doubling connections from the 'refresh' button
- upgrade to WS endpoint