SUBMITTED TO SUBMITTED BY
Dept. of Information
Technology, DTU Mr. Kapil Sharma, Akaash Nidhiss 2K19/IT/008
HOD of Dept. of Information Technology Anasuya Mithra 2K19/IT/018
Image Encryption &
Decryption using
AES Algorithm
Table of
Contents
I Introduction
II AES
III Operation of AES
IV Code
V Output Screenshots
V Conclusion
I Introduction
There has been a recent increase in the number of people who
use computers and other gadgets for communication and data
transmission. Along with these individuals, there has been an
increase in the number of unauthorised users who are attempting
to gain access to data through deception. As a result, the issue of
data security arises. Images are transferred across an unsecured
transmission channel from a variety of sources; some image data
contains classified data, and some images are very sensitive;
hence, protecting them from assault is crucial.
To fix this, we encrypt and decrypt images using the AES method.
Unauthorized users cannot read this encrypted data. It can be
delivered across the network and decrypted at the receiving end
using AES. As a result, the image transmission is secured.
3
I AES
AES is based on
Key Points
‘substitution–permutation
network’. It comprises of a
AES is a symmetric block cipher.
series of linked operations,
The key size can be 128/192/256
some of which involve
bits.
replacing inputs by specific
Encrypts data in blocks of 128 bits
outputs (substitutions)
each.
and others involve shuffling
Stronger and faster than Triple-DES
bits around
The number of rounds depends on
(permutations). AES is
the key length as follows :
widely used today as it is a
128 bit key – 10 rounds
much stronger than DES
192 bit key – 12 rounds
and triple DES despite
256 bit key – 14 rounds
being harder to implement.
4
I Operation of AES
AES uses bytes rather than bits to
conduct operations. The cipher
handles 128 bits (or 16 bytes) of
input data at a time since the block
size is 128 bits.
These 16 bytes are arranged in 4
columns and 4 rows for processing
as a matrix.
The number of rounds in AES is
variable and depends on the length
of the key. Each of these rounds uses
a different 128-bit round key, which is
calculated from the original AES key.
5
I Encryption
AES considers each block as a 16 byte (4 byte x 4
byte = 128 ) grid in a column major arrangement.
Each round comprises of 4 steps:
SubBytes
ShiftRows
MixColumns
Add Round Key
The last round doesn’t have the MixColumns
round.
The SubBytes does the substitution and ShiftRows
and MixColumns performs the permutation in the
algorithm.
5
I Decryption
The stages in the rounds can be easily undone as
these stages have an opposite to it which when
performed reverts the changes. Each 128 blocks
Since sub-processes in each round are
goes through the 10,12 or 14 rounds depending on
in reverse manner, unlike for a Feistel
the key size.
Cipher, the encryption and decryption
The stages of each round in decryption is as
algorithms needs to be separately
follows :
implemented, although they are very
Add round key
closely related.
Inverse MixColumns
ShiftRows
Inverse SubByte
5
CODE
II Output Screenshots
The root folder contains the following files;
secret.txt
script.py, secret.txt, secret1.txt, cat.jpg.
cat.jpg
secret.txt
7
II Output Screenshots
When we run ‘script.py’ for the first time, we have:
After running the following code, the data.txt.enc file is created which contains the
password, ‘cyberforensics’
The encrypted file appears like this.
7
II Output Screenshots
Once we run the script.py file again, the code prompts us for the password.
Thus the secret.txt file is encrypted.
7
II Output Screenshots
When we choose to encrypt all files in the directory.
7
II Conclusion
The system encrypts the provided file into an
unreadable format. This is accomplished
through the use of the AES encryption algorithm.
The system decrypts the encrypted file and
converts it to a readable format. This is
accomplished through the use of the AES
decryption mechanism. The produced image
should be identical to the original.
The mechanism ensures that the image is
safely sent via any medium. Because
unauthorised access is not permitted, a third-
party system cannot make changes to the file
being delivered.
8
Thank you
for listening!