Cryptography | DES implementation in C

 
The Data Encryption Standard (DES) is a symmetric-key algorithm for the encryption of electronic data. Although now considered insecure, it was highly influential in the advancement of modern cryptography.

This article do not cover explanation of DES Algorithm. We suggest to go through very nice tutorial given here for detailed step-by-step explanation.
 

INPUT FILES TO THE PROGRAM-


input.txt – WILL CONTAIN OUR PLAIN TEXT (Max. Limit of plain text is 64kb).
key.txt – WILL CONTAIN 64-BIT KEY
(take 0001001100110100010101110111100110011011101111001101111111110001)

 
DES implementation –
 

 

OUTPUT FILE –
result.txt – IT WILL CONTAIN OUR DECRYPTED TEXT.
 

TEMP FILES –
bits.txt – IT WILL CONTAIN OUR PLAIN TEXT CONVERTED IN BITS.
cipher.txt – IT WILL CONTAIN OUR ENCRYPTED TEXT IN BITS.
decrypted.txt – IT WILL CONTAIN OUR DECRYPTED TEXT IN BITS (SAME AS bits.txt IN CONTENT)

 
Above program is tested in Windows environment using Code::Blocks 16.01.

 
Exercise: Extend the solution to implement 3-DES algorithm.

 
Thanks for reading.




Please use ideone or C++ Shell or any other online compiler link to post code in comments.
Like us? Please spread the word and help us grow. Happy coding 🙂
 





Leave a Reply

Notify of
avatar
wpDiscuz