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 (
.mp4
format) π₯ - Text Files: Encrypt/decrypt text documents (
.txt
format) π - 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.txt
from 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.txt
for 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