Coders Packet

128-bit AES encryptor and decryptor in C++

By Sharad Verma

This C++ packet performs 128-bit AES encryption and decryption on plain data and encrypted data respectively.

This C++ code implements AES encryption and decryption, the Advanced Encryption Standard (AES) is a symmetric block cipher which is implemented in software and hardware throughout the world to encrypt sensitive data. This code performs the software implementation of 128-bit AES encryption. 

This packet includes the following files -

1- decoding.h we have a header file named decoding.h which implements the actual algorithm to obtain the plain text from the encrypted data.

2- encoding.h : This header implements the algorithm to encrypt the plain text. 

3- key_expand.h : 128-bit AES requires 10 rounds of encryption and each round requires a distinct key, all these keys are actually generated from the original key and this process of generating keys is called key expansion. This header file includes the function to perform key expansion.  

4- lookup_table_encoding .h : Each round of AES encryption is performed in various steps and in one of the steps called mix column, we use Galois multiplication lookup tables to ease our task. This header file includes all the lookup tables required for encoding.

5- lookup_table_decoding .h : this header file includes all the corresponding lookup up tables required for the decryption.

6- main.cpp : This c++ file includes the driver code required for the implementation of the algorithm.

7- input.txt : In this text file we write the plain text which is needed to be encrypted, our code reads plain text from this file and stores the encrypted data in encryption.aes.

8- encryption.aes : encrypted data is stored in this file during encryption and our code reads the data from this file while performing decryption.

9- outputtext.txt : After the decryption, our plain text obtained from the encrypted data is stored in this file.

10- key.txt : symmetric key required for the encryption and decryption is stored in this text file.

 

Steps to perform encryption ->

1- Store plain text in input.txt file.

2- write your key in file key.txt

3- Run the code and choose the option of encryption.

4- encrypted data will be stored in encryption.aes.

 

Steps to perform decryption ->

1- store encrypted data in file encryption.aes

2- write the key in file key.txt which was used during encryption.

3- Run the program and choose the option of decryption.

4- Plain text will be shown as output as well as it will be stored in the text file outputtext.txt.

Download Complete Code

Comments

  • Smart Ladka :

    Thanks vro.

  • Reply to this comment