A comprehensive implementation of Simplified Data Encryption Standard (S-DES) and Simplified Advanced Encryption Standard (S-AES) with support for multiple operation modes and various file types.
-
S-DES (Simplified Data Encryption Standard) 🛡️
- 10-bit key encryption
- 8-bit block cipher
- Educational implementation of DES principles
-
S-AES (Simplified Advanced Encryption Standard) 🔐
- 16-bit key encryption
- 16-bit block cipher
- Simplified version of AES for learning purposes
Both S-DES and S-AES support the following 5 operation modes:
-
ECB (Electronic Codebook) 📚
- Each block encrypted independently
- Simple but less secure for repetitive data
-
CBC (Cipher Block Chaining) 🔗
- Each block XORed with previous ciphertext
- Requires initialization vector (IV)
-
CFB (Cipher Feedback) 🔄
- Stream cipher mode
- Encryption of IV creates keystream
-
OFB (Output Feedback) 🔁
- Stream cipher mode
- IV encrypted repeatedly to generate keystream
-
CTR (Counter) 🔢
- Stream cipher mode
- Counter encrypted to generate keystream
- Images: Process image files with encryption/decryption 🖼️
- Videos: Handle video file encryption (
.mp4format) 🎥 - Text Files: Encrypt/decrypt text documents (
.txtformat) 📄 - JSON: Configuration and key files 📋
- Brute Force Attack: Implement brute force decryption for text files 💥
- Key Generation: Automatic key generation utilities 🔑
- File I/O: Robust file handling for various formats 📂
Crypto/
├── s-aes/ 🔐
│ ├── CBC.py # 🔗 Cipher Block Chaining mode
│ ├── CFB.py # 🔄 Cipher Feedback mode
│ ├── CTR.py # 🔢 Counter mode
│ ├── ECB.py # 📚 Electronic Codebook mode
│ ├── OFB.py # 🔄 Output Feedback mode
│ ├── S-AES.json # ⚙️ Configuration file
│ ├── S_AES_Decryption.py # 🔓 Main decryption module
│ ├── S_AES_Encryption.py # 🔒 Main encryption module
│ ├── key.json # 🔑 Key storage
│ ├── text.txt # 📄 Sample text file
│ ├── video.mp4 # 🎥 Sample video file
│ └── Class Diagram1.jpg # 📊 Project documentation
│
├── s-des/ 🛡️
│ ├── CBC.py # 🔗 Cipher Block Chaining mode
│ ├── CFB.py # 🔄 Cipher Feedback mode
│ ├── CTR.py # 🔢 Counter mode
│ ├── ECB.py # 📚 Electronic Codebook mode
│ ├── OFB.py # 🔄 Output Feedback mode
│ ├── S-DES.json # ⚙️ Configuration file
│ ├── S_DES_decryption.py # 🔓 Main decryption module
│ ├── S_DES_encryption.py # 🔒 Main encryption module
│ ├── text.txt # 📄 Sample text file
│ ├── text_recovered.txt # 🔄 Recovered text file
│ ├── video.mp4 # 🎥 Sample video file
│ └── Class Diagram1.jpg # 📊 Project documentation
│
├── .gitignore # 📝 Git ignore rules
├── README.md # 📖 Project documentation
└── key.json # 🔑 Global key storage
- Clone the repository:
git clone [repository-url]
cd Crypto- Install required dependencies:
pip install -r requirements.txtfrom S_AES_Encryption import encrypt_file
# Encrypt a text file
encrypt_file('input.txt', 'output.enc', key='your-16-bit-key', mode='CBC')
# Encrypt an image
encrypt_file('image.jpg', 'image.enc', key='your-16-bit-key', mode='ECB')from S_AES_Decryption import decrypt_file
# Decrypt a file
decrypt_file('encrypted.enc', 'decrypted.txt', key='your-16-bit-key', mode='CBC')from S_DES_encryption import s_des_encrypt
from S_DES_decryption import s_des_decrypt
# Encrypt/decrypt with S-DES
plaintext = "Hello"
key = "1010000010" # 10-bit key
encrypted = s_des_encrypt(plaintext, key)
decrypted = s_des_decrypt(encrypted, key)from ECB import encrypt_ecb, decrypt_ecb
result = encrypt_ecb(data, key)from CBC import encrypt_cbc, decrypt_cbc
result = encrypt_cbc(data, key, iv)from CFB import encrypt_cfb, decrypt_cfb
result = encrypt_cfb(data, key, iv)from OFB import encrypt_ofb, decrypt_ofb
result = encrypt_ofb(data, key, iv)from CTR import encrypt_ctr, decrypt_ctr
result = encrypt_ctr(data, key, counter)For educational purposes, implement brute force attacks on encrypted text:
def brute_force_text(encrypted_text, known_plaintext=None):
"""
Attempt to decrypt text using brute force method 🔓💪
"""
# Implementation for trying all possible keys
pass- Direct encryption/decryption of text content
- Support for various encodings (UTF-8, ASCII)
- Includes
text_recovered.txtfor brute force results
- Pixel-level encryption
- Maintains image structure while encrypting pixel data
- Supports common formats (JPEG, PNG)
- Frame-by-frame encryption
- Maintains video container structure
- Encrypts video stream data
- S-DES and S-AES are simplified versions with reduced security
- Real-world applications should use proven cryptographic libraries
- Keys should be generated using cryptographically secure random generators
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project demonstrates:
- Block cipher operation modes
- Symmetric encryption principles
- File handling in cryptographic contexts
- Brute force attack methodologies
- Key management practices
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on educational materials for cryptography courses
- Implements simplified versions of industry-standard algorithms
- Designed for learning and demonstration purposes