► Caesar, Rail Fence and AES encryption using Python and a Flask website
Developed with the software and tools below.
A demo project written in Python 3.12 to demonstrate encryption and decryption of English text with 3 algorithems: Caesar, Rail Fence (Zigzag) and AES. If you don't supply an encryption key for Caesar or Rail Fence, all possible options will be displayed as bruteforce encryption/decryption. The code is exposed as a webpage through Flask framework.
Link to a live demo running on Google Cloud
Caesar
- Encryption, supplying an integer numerical key
- Decryption, supplying an integer numerical key
- Encryption/Decryption, without supplying a key - displaying all possible 25 options
Rail Fence (Zigzag)
- Encryption, supplying an integer numerical key
- Decryption, supplying an integer numerical key
- Encryption/Decryption, without supplying a key - displaying all possible 25 options
AES
- Encryption, using a random key and pre-generated password
- Decryption, extracting the key from the message using the pre-generated password
└── python-encryption-bagrut/
├── README.md
├── __pycache__
│ └── function.cpython-311.pyc
├── Server-Start.py
├── function.py
├── static
│ └── css
│ └── main.css
│ └── js
│ └── script.js
└── templates
├── data.html
└── form.html
Code Elements
File | Summary |
---|---|
function.py | ► Main file that holds all the encryption/decryption functions |
Server-Start.py | ► Flask container that handles HTTP requests and distributes them to functions in function.py |
Templates
| File | Summary | | --- | --- | | [form.html](https://github.com/ithamarkap/python-encryption-bagrut/blob/master/templates/form.html) |► Input form
|
| [data.html](https://github.com/ithamarkap/python-encryption-bagrut/blob/master/templates/data.html) | ► Result output
|
Requirements
Ensure you have the following dependencies installed on your system:
- Python:
version 3.x.x
Use the install instructions on their website
-
Clone the python-encryption-bagrut repository or download and extract the zip file
-
Change to the project directory:
cd python-encryption-bagrut
- Activate the virtual environment and install the cryptography package:
.\flask2\Scripts\activate
pip install flask
pip install cryptography
Use the following command to run python-encryption-bagrut:
python Server-Start.py
You'll see the following lines confirming Flask is up:
* Serving Flask app 'Server-Start'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:80
* Running on http://xxx.xxx.xxx.xxx:80
Open your web browser and navigate to http://localhost:80
- Thanks to @Lev-Shapiro for great design and UI contributions.