Encrypter - Flask-based Encryption Tool
Web application for encryption and data transformation with user authentication and file upload support
Technologies Used
Encrypter - Flask-based Encryption Tool
Overview
Encrypter is a comprehensive Flask-based web application that provides encryption, decryption, and data transformation capabilities. The application features user authentication, file upload support, recipe-based operations, and MySQL-backed history storage for tracking all encryption activities.
Problem Statement
Many users need to encrypt sensitive data but lack access to user-friendly encryption tools. Existing solutions are often:
- Command-line based and intimidating for non-technical users
- Lack proper user management and history tracking
- Don't support multiple encryption methods
- Missing file upload capabilities
Solution
Encrypter provides a web-based solution with:
- User-Friendly Interface: Clean web UI accessible from any browser
- Multiple Encryption Methods: Support for various encryption algorithms
- Recipe-Based Operations: Chain multiple encryption/transformation steps
- File Upload Support: Encrypt files directly through the web interface
- History Tracking: MySQL database stores all operations for audit trails
- User Authentication: Secure login system for multi-user support
Key Features
1. User Authentication System
- Secure registration and login
- Password hashing with bcrypt
- Session management
- User-specific encryption history
2. Multiple Encryption Methods
- AES Encryption: Industry-standard symmetric encryption
- Base64 Encoding: Simple encoding for data transfer
- ROT13: Classic cipher for basic obfuscation
- Custom Ciphers: Extensible architecture for adding new methods
3. Recipe-Based Operations
- Chain multiple encryption steps
- Save and reuse encryption recipes
- Apply complex transformations with one click
- Recipe sharing between users
4. File Upload & Processing
- Upload files for encryption
- Support for multiple file formats
- Batch processing capabilities
- Encrypted file download
5. History & Audit Trail
- MySQL database stores all operations
- View past encryption/decryption activities
- Search and filter history
- Export history for compliance
Technical Implementation
Architecture
Frontend (HTML/CSS/JS) → Flask Backend → MySQL Database
↓
Cryptography Library
Technologies Used
- Backend: Python Flask
- Database: MySQL
- Encryption: Python cryptography library
- Frontend: HTML5, CSS3, JavaScript
- Authentication: Flask-Login, bcrypt
- File Handling: Werkzeug
Database Schema
-- Users Table
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
email VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- History Table
CREATE TABLE encryption_history (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT,
operation_type VARCHAR(20),
method VARCHAR(50),
input_data TEXT,
output_data TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- Recipes Table
CREATE TABLE recipes (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT,
recipe_name VARCHAR(100),
steps JSON,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);
Key Components
-
Flask Application
- Route handlers for all operations
- Request validation and error handling
- Session management
- File upload handling
-
Encryption Module
- Implements various encryption algorithms
- Key generation and management
- Data transformation functions
-
Database Layer
- MySQL connection pooling
- CRUD operations for users and history
- Transaction management
-
Frontend Interface
- Responsive design
- AJAX for asynchronous operations
- Real-time feedback
- File drag-and-drop
My Contribution
As the team leader of a 4-member team, I was responsible for:
- Project Architecture: Designed the overall system architecture
- Backend Development: Implemented Flask routes and encryption logic
- Database Design: Created MySQL schema and queries
- Team Leadership: Coordinated tasks and managed project timeline
- Code Review: Ensured code quality and best practices
- Documentation: Created user guides and technical documentation
Implementation Highlights
Encryption Example
from cryptography.fernet import Fernet
def encrypt_data(data, key):
"""Encrypt data using Fernet symmetric encryption"""
f = Fernet(key)
encrypted = f.encrypt(data.encode())
return encrypted.decode()
def decrypt_data(encrypted_data, key):
"""Decrypt data using Fernet symmetric encryption"""
f = Fernet(key)
decrypted = f.decrypt(encrypted_data.encode())
return decrypted.decode()
Recipe Processing
def apply_recipe(data, recipe_steps):
"""Apply a series of encryption/transformation steps"""
result = data
for step in recipe_steps:
method = step['method']
params = step['params']
result = apply_method(result, method, params)
return result
Challenges & Solutions
Challenge 1: Key Management
Problem: Securely storing and managing encryption keys
Solution: Implemented key derivation from user passwords using PBKDF2
Challenge 2: Large File Handling
Problem: Memory issues when encrypting large files
Solution: Implemented streaming encryption for files larger than 10MB
Challenge 3: Recipe Validation
Problem: Ensuring recipe steps are valid and compatible
Solution: Created a validation system that checks step compatibility before execution
Security Features
- ✅ Password hashing with bcrypt (cost factor: 12)
- ✅ SQL injection prevention using parameterized queries
- ✅ CSRF protection with Flask-WTF
- ✅ Secure session management
- ✅ Input validation and sanitization
- ✅ Rate limiting on authentication endpoints
Results & Impact
- ✅ Successfully deployed for team use
- ✅ Processed 1000+ encryption operations during testing
- ✅ Zero security incidents during development
- ✅ Positive feedback from non-technical users
- ✅ Completed as Python mini-project requirement
Future Enhancements
- Add support for asymmetric encryption (RSA)
- Implement two-factor authentication
- Add API endpoints for programmatic access
- Create mobile app version
- Add support for more file formats
- Implement end-to-end encryption for file sharing
Project Timeline
Duration: September 2025 - October 2025 (2 months)
- Week 1-2: Requirements gathering and design
- Week 3-4: Backend development and database setup
- Week 5-6: Frontend development and integration
- Week 7-8: Testing, bug fixes, and documentation
Team
- Devanshu Bansode (Team Leader) - Architecture, Backend, Database
- Team Member 2 - Frontend Development
- Team Member 3 - Encryption Module Implementation
- Team Member 4 - Testing and Documentation
Lessons Learned
- Security First: Always prioritize security in encryption applications
- User Experience: Complex cryptography can be made accessible with good UX
- Team Collaboration: Clear communication is key to successful team projects
- Testing: Thorough testing is crucial for security-critical applications
Conclusion
Encrypter successfully demonstrates the practical application of cryptography in a user-friendly web application. The project combines secure coding practices with modern web development to create a tool that makes encryption accessible to everyone.
Project Status: Completed ✅
GitHub: View Repository
Tech Stack: Python, Flask, MySQL, Cryptography