Coders Packet

CBC mode AES cryptography in Python

By Kirti Vardhan

It is a Python code which asks for data in csv format for CBC mode encryption or decryption, performs the required operation and saves the output in the same file as different columns.

THIS CODE PAKCET SHOULD BE OPENED WITH GOOGLE COLAB OR JUPYTER NOTEBOOK FOR BETTER READABILITY.


DESCRIPTION : Cryptography is a method of protecting information and communications using codes, so that only specific people, with the pass key and initialization vector, can read and process it.This packet focusses on 128-bits CBC mode encryption and decryption in both HEX and base_64 formats.

INPUT AND OUTPUT : A csv file with a column of input text to be encrypted or decrypted should be uploaded through google drive or from the device as input data for the code. The code then asks the user for the key and the initialization vector. These should be 16 digit long because the key size is set to be 128-bits. Then the user must clarify whether they have to encrypt or decrypt the csv file. There are separate functions for that. Afterwards the result in both HEX and Base_64 formats is saved in the same input file as different columns.

A zip file of the python notebook has been uploaded with a sample input.

(Note that for key and initialization vector(iv), a number of size different from 16 would result in an error)

Download project

Reviews Report

Submitted by Kirti Vardhan (Kirti1)

Download packets of source code on Coders Packet