Skip to content

Commit 842c960

Browse files
Update README.md
1 parent cb6574d commit 842c960

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

README.md

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,106 @@
1-
# cpu-gpu-combined-encryption-algorithm-aes128
1+
# File Encryption Project
2+
3+
This project provides a robust solution for encrypting and decrypting files within a specified folder using AES encryption with a hybrid CPU-GPU approach for optimized performance. The encryption key is derived using the HKDF (HMAC-based Key Derivation Function) combined with the scrypt algorithm for added security.
4+
5+
## Features
6+
7+
- **Hybrid CPU-GPU Processing**: Automatically adjusts the workload between CPU and GPU based on system resource usage.
8+
- **AES Encryption**: Utilizes AES encryption with Electronic Codebook (ECB) mode for file security.
9+
- **HKDF-Scrypt Key Derivation**: Combines HKDF and scrypt for secure key derivation.
10+
- **System Resource Monitoring**: Monitors CPU and memory usage to optimize encryption/decryption processes.
11+
- **Cross-Platform Compatibility**: Runs on systems with or without GPU support.
12+
13+
## Requirements
14+
15+
- Python 3.7 or higher
16+
- Required Python packages:
17+
- hashlib
18+
- hmac
19+
- scrypt
20+
- secrets
21+
- psutil
22+
- pycryptodome
23+
- torch
24+
- torchcsprng
25+
- numpy
26+
27+
## Installation
28+
29+
1. Clone the repository:
30+
```sh
31+
git clone https://github.com/heshan-basnayaka/cpu-gpu-combined-encryption-algorithm-aes128.git
32+
cd cpu-gpu-combined-encryption-algorithm-aes128
33+
34+
2. CInstall the required packages:
35+
```sh
36+
pip install hashlib hmac scrypt secrets psutil pycryptodome torch torchcsprng numpy
37+
38+
## Usage
39+
40+
### Encryption and Decryption
41+
42+
#### Setup Parameters:
43+
Update the parameters in the main section of the script according to your requirements:
44+
45+
- `password`: Your encryption password.
46+
- `salt`: A 32-character hexadecimal string.
47+
- `length`: Desired key length in bytes.
48+
- `n`, `r`, `p`: Parameters for the scrypt algorithm.
49+
- `folder_path`: Path to the folder containing files to be encrypted/decrypted.
50+
- `mode`: Set to `'encrypt'` or `'decrypt'`.
51+
52+
#### Run the Script:
53+
```sh
54+
python your_script_name.py
55+
```
56+
### Example
57+
58+
Update the following section in the script with your details:
59+
60+
```python
61+
password = "yourpassword"
62+
salt = "12345678901234567890123456789012"
63+
length = 16
64+
n = 2**10
65+
r = 8
66+
p = 5
67+
folder_path = "path_to_your_folder"
68+
mode = 'encrypt' # or 'decrypt'
69+
```
70+
Execute the script to start the encryption or decryption process. The script will automatically adjust the workload between CPU and GPU and monitor system resources during the process.
71+
72+
### Output
73+
74+
- Encrypted files will have their contents replaced with encrypted data.
75+
- Decrypted files will have their contents restored to their original form.
76+
- A file named `backup_key.txt` will store the base64 encoded derived key when in encryption mode.
77+
78+
### Monitor System Resources
79+
80+
The script monitors CPU and memory usage to determine the optimal ratio of workload distribution between CPU and GPU. This ensures efficient utilization of system resources.
81+
82+
### Hybrid CPU-GPU Encryption
83+
84+
Depending on the system's GPU availability and resource usage, the script will divide the encryption workload between CPU and GPU. If no GPU is available, it will default to using only the CPU.
85+
86+
### Key Storage
87+
88+
In encryption mode, the derived key will be encoded using base64 and stored in a file named `backup_key.txt`. This file should be securely stored as it is necessary for decrypting the files.
89+
90+
## License
91+
92+
This project is open-sourced under the MIT License. See the [LICENSE](LICENSE) file for more information.
93+
94+
## Contributing
95+
96+
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
97+
98+
## Acknowledgments
99+
100+
- PyCryptodome for AES encryption support.
101+
- PyTorch and torchcsprng for GPU-based cryptographic operations.
102+
- psutil for system resource monitoring.
103+
104+
## Contact
105+
106+
For any questions or suggestions, please contact [heshankb@gmail.com].

0 commit comments

Comments
 (0)