Coder Social home page Coder Social logo

des-multithreaded's Introduction

DES Encryption / Decryption

Compiling the program

the new version of our program is Multi-Threaded, for compilation use:

g++ -pthread -o main_threaded main_threaded.cpp

note: compilation without pthread option will result in undefined reference to `pthread_create' error.

Program Structure

1. constans.cpp

contains all the permutation and expansion, required shift matrices

2. numsys.cpp

numsys contains function to convert between many systems as following

3.operations.cpp

permute takes the string, permutes it with the given permutation matrix in the specified size.

shift_lift takes the key, shifts it according to the number of round

XOR takes two HEX numbers and apply bitwise XOR operation

Fesitel_func apply the Feistel function to the text with the given key

key_preparation prepares the key in the beginning of each round (encryption or decryption)

DES_enc_round applies a full encryption round according to the given round number

DES_dec_round applies a full decryption round according to the given round number

4. main_threaded.cpp

The main file, in which we handle the I/O operations, and applying the full encryption / decryption

enc_block applies encryption for a 64 bit block

dec_block applies decryption for a 64 bit block

encrypt applies encryption on the full_text

decrypt applies decryption on the full_text

hex_reader reads file.hex (it was stated previously that the program should read .hex files)

Implementation Details

Single-Threaded Version

The first version of the program was single threaded, such an implementation bottlenecked single thread in a long sequential functions.

single_threaded

Multi-Threaded Version

In order to push the performance further and increase the utilization, we used 16 threads to perfrom all the operations just after dividing the text into more than 16 threads, from permutations, conversions and the whole ecnryption / decryption process.

The effect of the implementation was a dramatic decrease in required time, specially for CPUs with more cores.

multi_threaded

We made a comparison between both versions

running_time

des-multithreaded's People

Contributors

0ssamaak0 avatar yousefelsharkawy 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.