Coder Social home page Coder Social logo

nano9911 / aes128_python3 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 195 KB

AES-128 Implementation in Python 3.9, Multi-threaded using 2 Queues

Python 100.00%
aes aes-128 aes-cipher rijndael rijndael-aes-cipher rijndael-algorithm python3 python python-cryptography cryptography cipher cipher-algorithms multithreading threading queueing

aes128_python3's Introduction

AES128_py

AES-128 Implementation in Python 3.9

Multi-threaded using threading module, and threads use queues from Queue or queue module to communicate

It's slow, and I'm still learning python, looking for your feedback.

With ECB & CTR Modes


Threads :

read_thread [Producer -> q1] --> Read data as states(16-Byte), check if it needs padding and do it. Then put it on q1 queue to be consumed.

operate_thread [Consumer -> q1 then Producer -> q2] --> Get data from q1 as states(16-Bytes), check the data [self.name] which was given when the thread created, do the appropriate operation. Then put the final value of the state to q1 Queue to be consumed.

write_thread [Consumer -> q2] --> Get data from q2 as states(16-Bytes), write it to the output file.


Command Line Arguments:

Mode:

"-ecb" --> ECB Mode || "-ctr" --> CTR Mode

Operation:

"-e" --> Encrypt || "-d" --> Decrypt

"-o" --> output file name || output file name = input file name + ".output"

"-k" --> read key value from the following file, will be read as bytesarray || key will be generated randomly

In case of CTR Mode :

"-iv" --> read IV from the following key || IV will be generated randomly


Example:

[ECB-Mode Encrypted | Read Key from "key.txt" | Name the output file "output.encrypted"]

python3 AES.py plain.txt -ecb -k key.txt -o output.encrypted -enc

[CTR-Mode | Generate Random Key | Read IV frim "IV.txt" | Name output file by default "cipher.aes.output"]

python3 AES.py cihper.aes -ctr -iv IV.txt

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.