Code Monkey home page Code Monkey logo

heshan-basnayaka / cpu-gpu-combined-encryption-algorithm-aes128 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 39 KB

a hybrid CPU-GPU combined multi-processing approach for optimized performance in AES128 algorithm. The encryption key is derived using the HKDF (HMAC-based Key Derivation Function) combined with the scrypt algorithm for added security.

Home Page: https://ieeexplore.ieee.org/document/10417489

License: GNU General Public License v3.0

Python 100.00%
aes-128 cpu gpu multi-processing

cpu-gpu-combined-encryption-algorithm-aes128's Introduction

AES128 GPU and CPU Combined Multi-Processing Algorithm

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.

Research Paper

A-STEM: Advanced Storage Toolkit for Encryption and Migrations. [https://ieeexplore.ieee.org/document/10417489]

Watch the Video [Link]

AES128 CPU & GPU Combined

Features

  • Hybrid CPU-GPU Processing: Automatically adjusts the workload between CPU and GPU based on system resource usage.
  • AES Encryption: Utilizes AES encryption with Electronic Codebook (ECB) mode for file security.
  • HKDF-Scrypt Key Derivation: Combines HKDF and scrypt for secure key derivation.
  • System Resource Monitoring: Monitors CPU and memory usage to optimize encryption/decryption processes.
  • Cross-Platform Compatibility: Runs on systems with or without GPU support.

Requirements

  • Python 3
  • Required Python packages:
    • hashlib
    • hmac
    • scrypt
    • secrets
    • psutil
    • pycryptodome
    • torch
    • torchcsprng
    • numpy

Installation

  1. Clone the repository:
    git clone https://github.com/heshan-basnayaka/cpu-gpu-combined-encryption-algorithm-aes128.git
    cd cpu-gpu-combined-encryption-algorithm-aes128
    
  2. CInstall the required packages:
    pip install hashlib hmac scrypt secrets psutil pycryptodome torch torchcsprng numpy
    

Usage

Encryption and Decryption

Setup Parameters:

Update the parameters in the main section of the script according to your requirements:

  • password: Your encryption password.
  • salt: A 32-character hexadecimal string.
  • length: Desired key length in bytes.
  • n, r, p: Parameters for the scrypt algorithm.
  • folder_path: Path to the folder containing files to be encrypted/decrypted.
  • mode: Set to 'encrypt' or 'decrypt'.

Run the Script:

python your_script_name.py

Example

Update the following section in the script with your details:

password = "yourpassword"
salt = "12345678901234567890123456789012"
length = 16
n = 2**10
r = 8
p = 5
folder_path = "path_to_your_folder"
mode = 'encrypt'  # or 'decrypt'

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.

Output

  • Encrypted files will have their contents replaced with encrypted data.
  • Decrypted files will have their contents restored to their original form.
  • A file named backup_key.txt will store the base64 encoded derived key when in encryption mode.

Monitor System Resources

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.

Hybrid CPU-GPU Encryption

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.

Key Storage

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.

License

This project is open-sourced under the MIT License. See the LICENSE file for more information.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Acknowledgments

  • PyCryptodome for AES encryption support.
  • PyTorch and torchcsprng for GPU-based cryptographic operations.
  • psutil for system resource monitoring.

Contact

For any questions or suggestions, please contact [[email protected]].

cpu-gpu-combined-encryption-algorithm-aes128's People

Contributors

heshan-basnayaka avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.