Commit 901593cf authored by Almouhannad Hafez's avatar Almouhannad Hafez

Initial commit

parents
__pycache__/s_des.cpython-39.pyc
# Data Security (DS) Course Project
**Simplified Data Encryption Standard (SDES)**
***By: Almouhannad Hafez***
1. **[Overview](#overview)**
1. **[Contents](#contents)**
1. **[Requirements](#requirements)**
## Overview
- The ***Data Encryption Standard (DES)*** is a symmetric-key algorithm for the encryption of digital data. Although its short key length of 56 bits makes it too insecure for modern applications, it has been highly influential in the advancement of cryptography.
- ***Simplified DES (SDES)*** was designed for educational purposes only, to help students learn about modern cryptanalytic techniques. SDES has similar structure and properties to DES, but has been simplified to make it much easier to perform encryption and decryption by hand with pencil and paper. Some people feel that learning SDES gives insight into DES and other block ciphers, and insight into various cryptanalytic attacks against them.
- [Source](https://en.wikipedia.org/wiki/Data_Encryption_Standard#Simplified_DES)
## Contents
> `s_des.py`
- SDES algorithm implementation
> `project.ipynb`
- A jupyter notebook containing algorithm usage example
## Requirements
1. **Open a Terminal or Command Prompt**
1. **Navigate to the Directory containing this repository**
```bash
cd path/to/repository/folder
```
1. **Install the Requirements**
```bash
pip install -r requirements.txt
\ No newline at end of file
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from s_des import SDES\n",
"\n",
"# Some more magic so that the notebook will reload external python modules;\n",
"# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"%reload_ext autoreload"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9\n",
"2\n"
]
}
],
"source": [
"sdes = SDES()\n",
"print(sdes.key_length)\n",
"print(sdes.rou)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Default",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.20"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
class SDES:
def __init__(self, rounds_count: int = 2, key_length: int = 9):
"""
Initialize the SDES algorithm with pre-defined parameters
Parameters:
rounds_count (int): Number of iterations to perform
key_length (int): Length of keys that will be used for encryption/decryption
"""
# Type checking
if not isinstance(rounds_count, int):
raise TypeError(f"Expected 'rounds_count' to be int, got {type(rounds_count).__name__}")
if not isinstance(key_length, int):
raise TypeError(f"Expected 'key_length' to be int, got {type(key_length).__name__}")
self.rounds_count = rounds_count
self.key_length = key_length
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment