Giter Site home page Giter Site logo

nano9911 / aes128_c-posix Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 171 KB

AES-128 implementation in C/POSIX, multi-threaded using <pthread.h>. Still learning, looking for your feedbacks.

C 100.00%
aes aes-encryption aes-128 aes-cipher rijndael rijndael-aes-cipher rijndael-128 linux posix pthread

aes128_c-posix's Introduction

AES128

AES-128 [ECB && CTR] Modes implementation in C/POSIX, multi-threaded using <pthread.h>.

Threads:

read : read state [16 Bytes] from file to buffer1. [Producer]

ecb_encrypt || ecb_decrypt || ctr_encrypt || ctr_decrypt : read state [16 Bytes] from buffer, operate on it, then move it to buffer2 [Producer & Consumer]

write: read state [16 Bytes] from buffer2, write it to the output file [Consumer]

Threads are oganised to work in parallel, producer consumer method, and synchronised using mutex lock.

Still learning, looking for your feedbacks.


Usage:

To compile: gcc -pthread AES.c -o [output filename/path]

Command line Arguments:

argv[1] = "-ecb" [use ECB mode] || "-ctr" [use CTR mode]

argv[2] = "-e" [Encrypt argv[3]] || "-d" [Decrypt argv[3]]

argv[3] = input file name

argv[4] = "-k"

argv[5] = "r" [Generate Random Key] || key file name

If argv[1] = "-ctr" : argv[6] = "-iv" argv[7] = "r" [Generate random IV] || IV file name

Output:

if argv[2] == "-e" --> cipher_aes.ecrypted else if argv[2] == "-d" --> plain.decrypted


Example:

gcc -pthread AES.c -o aes

aes -ecb -e plain.txt -k key.txt

aes -ecb -d cipher.txt -k key.txt

aes -ctr -e plain.txt -k key.txt -iv IV.txt

aes -ctr -d encrypted.aes -k key.txt -iv IV.txt

aes128_c-posix's People

Contributors

nano9911 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.