Skip to content

ithamarkap/python-encryption-bagrut

Repository files navigation

Ithamar Kaplan's Bagrut Project

► Caesar, Rail Fence and AES encryption using Python and a Flask website

Developed with the software and tools below.

Visual Studio Code IDE GitHub Python Flask HTML5 CSS


Quick Links


Overview

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.


Live Demo

Link to a live demo running on Google Cloud


Features

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

Repository Structure

└── 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 flow diagram

code-flow.png


Modules

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 |

Getting Started

Requirements

Ensure you have the following dependencies installed on your system:

  • Python: version 3.x.x Use the install instructions on their website

Installation

  1. Clone the python-encryption-bagrut repository or download and extract the zip file

  2. Change to the project directory:

cd python-encryption-bagrut
  1. Activate the virtual environment and install the cryptography package:
.\flask2\Scripts\activate
pip install flask
pip install cryptography

Running python-encryption-bagrut

Use the following command to run python-encryption-bagrut:

python Server-Start.py

Accessing the user interface

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

Acknowledgments

  • Thanks to @Lev-Shapiro for great design and UI contributions.