Sie sind auf Seite 1von 51

Image Encryption Using Pixel

Scrambling and AES Algorithm:


A critical comparison of
different modes of AES
PRESENTED BY:
MAMTA DAS (B112068)
SANDEEP PARIDA (B112036)
CHANDRASEKHAR SATAPATHY (B112014)

CRYPTOGRAPHY

Practice and study of hiding information.


Art

and Science of converting a plain


intelligible data into an unintelligible data
and again retransforming that message into
its original form.

It provides CONFIDENTIALITY, INTEGRITY and

ACCURACY.

INTRODUCTION

A digital image is defined as a matrix.


Each element of the matrix represents the

intensity values of the pixels of an image.


The

cryptographic approaches that work


quite well on text data, do not give the same
performance on multimedia data.

Need

to develop
multimedia data.

algorithms

to

encrypt

Advanced
Encryption
Standard (AES) is a
well-known
algorithm
to encrypt the digital
data.

Fails
to
securely
encrypt digital images
that
have
pixels
similar to each other.

The cause for this can


be attributed to the
fact
that
the
multimedia data is
very large in size.

Has
a
lot
of
redundancy and the
adjacent pixels are
having close similarity
among them.

An attempt has been made to augment the

strengths of AES algorithm for image data


encryption.
A preprocessing step has been introduced
In this step the contents of the image are

divided into blocks containing some pixels.


Then

these blocks are scrambled and


randomly passed to the different modes of
AES for encryption.

AES ALGORITHM

Based on a design principle known


substitution-permutation network.

as

It has a fixed block size of 128 bits, and a key


size of 128, 192, or 256 bits.

The key size used for an AES cipher specifies the


number of repetitions of transformation rounds
that convert the input, called the plaintext, into
the final output, called the ciphertext.

BLOCK DIAGRAM

BYTE SUBSTITUTION
LAYER

It can be viewed as a row of 16 parallel S-Boxes,


each with 8 input and output bits.

In the layer, each state byte Ai is replaced, i.e.,


substituted, by another byte Bi:

S(Ai) = Bi.

The S-Box substitution is a bijective mapping,


i.e., each of the 28 = 256 possible input elements
is one-to-one mapped to one output element.

le: AES S-Box: Substitution values in hexadecimal notation for input by

DIFFUSION LAYER

It consists of two sublayers, the ShiftRows

transformation layer
transformation layer.

and

the

MixColumn

The

diffusion layer performs a linear


operation on state matrices A and B, i.e.,
DIFF(A)+ DIFF(B) = DIFF(A + B).

SHIFT ROWS SUBLAYER

The

ShiftRows transformation cyclically


shifts the second row of the state matrix by
three bytes to the right, the third row by
two bytes to the right and the fourth row by
one byte to the right.

The purpose of the ShiftRows transformation

is to increase the diffusion properties of


AES.

Input
of
the
ShiftRows Layer

The Output is the


new State

MIX COLUMN SUBLAYER

It is a linear transformation which mixes

each column of the state matrix.


We denote the 16-byte input state by B and

the 16-byte output state by C


C = MixColumn(B),
where B is the state after the ShiftRows
operation.

For Eg:

e second column of output bytes (C4,C5,C6,C7) is computed


ultiplying the four input bytes (B4,B9,B14,B3) by the same
nstant matrix, and so on.

KEY ADDITION LAYER

The two inputs to the Key Addition layer

are the current 16-byte state matrix and


a sub key which also consists of 16
bytes.
The two inputs are combined through a

bitwise XOR operation

MODES OF AES

Initialization Vector(IV) : Block of bits that


are used by several modes to randomize the
encryption.
Initialization vector is never reused under

the same key.


An initialization vector has different security

requirements than a key, so the IV usually


does not need to be secret.

Padding: A block cipher works on units of a

fixed size (known as a block size), but


messages come in a variety of lengths.
So some modes require that the final block

be padded before encryption.


The simplest is to add null bytes to the

plaintext to bring its length up to a multiple


of the block size.

ECB (Electronic Code Book)

Simplest of the encryption modes.


Message is divided into blocks, and each

block is encrypted separately.


In ECB identical plaintext blocks are

encrypted into identical ciphertext blocks;


thus, it does not hide data patterns well.

Fig:ECB encryption and decryption block diagram

CBC (Cipher Block


Chaining)
Each block of plaintext is XORed with the

previous ciphertext block before being


encrypted.
To make each message unique, an

initialization vector must be used in the first


block
Ciphertext stealing: A one-bit change in a

plaintext or IV affects all following


ciphertext blocks.

Fig: CBC encryption and decryption block diagram

CFB (Cipher Feedback)

A close relative of CBC.


It makes a block cipher into a self-

synchronizing stream cipher.


Operation is very similar to CBC; in

particular, CFB decryption is almost identical


to CBC encryption performed in reverse.

Fig: CFB encryption and decryption block diagram

OFB (Ouput Feedback)

This mode makes a block cipher into a

synchronous stream cipher.


It generates keystream blocks, which are

then XORed with the plaintext blocks to get


the ciphertext.

This property allows many error correcting


codes to function normally even when
applied before encryption.

Fig: OFB encryption and decryption block diagram

CTR (Counter)

Counter mode turns a block cipher into a

stream cipher.
It generates the next key stream block by

encrypting successive values of a "counter".


The counter can be any function which
produces a sequence which is guaranteed
not to repeat for a long time.
It does not suffer from the short-cycle

problem that can affect OFB.

Fig: CTR encryption and decryption block diagram

PARAMETERS
USED FOR
SECURITY
ANALYSIS
S

SSIM (Structural
Similarity Index)

It is a method for predicting the perceived


quality of digital images.

SSIM is used for measuring the similarity


between two images.

SSIM is a full reference metric; in other words,


the measurement or prediction of image
quality is based on an initial uncompressed or
distortion-free image as reference.

The SSIM index is calculated on various

windows of an image. The measure between


two windows x and y of common size N * N
is:

MSE (Mean Square


Error)

MSE measures the average of the squares of the


errors or deviations i.e., the difference between the
estimator and what is estimated.

The difference occurs because of randomness or


because the estimator doesnt account for
information that could produce a more accurate
estimate.

Quality is based on the apparent differences between


a degraded image and the original, unmodified image.

A value greater than one implies less

similarity and will continue to grow as the


average difference between pixel intensities
increases as well.

PROPOSED
CRYPTOSYSTEM

Goals Of The Proposed


System
Decrease

the similarity among the


neighboring pixels of the encripted
image.

Compare the similarity of the original

image with ciphered image (only AES)


and with the results obtained from our
proposed algorithm.

Design Of The Proposed


System
Scrambling Procedure
The image when provided as the input is

divided into a number of blocks consisting of


pixels.
Inside

each block, pixels


according to the algorithm.

are

The scrambled image is obtained.

rotated

Encryption Procedure

Crypto Cipher module is used in Python to implement


the AES algorithm.

The scrambled image from the previous step is fed as


input to the AES.

The processed output image seems to have less


structural similarity and more mean square error as
compared to when we received output using AES only.

RESULT AND
ANALYSIS

Simulation Methodology

The scrambling and encryption has been done


in Python software package.

For analysis the following image has been


selected.

Result After Using Only


Scrambling

Original Image

Scrambled Image

Results After Using


Proposed System To
Different Modes Of AES

ECB Mode of Encryption

Original Image

CFB Mode

CBC Mode

OFB Mode

CTR mode

Security Analysis

Though the images that are generated after


encryption seems to be the same, there are subtle
differences which can only be measured by using
advanced image matching techniques.

To analyze the difference between image encrypted


using only AES and our proposed cryptosystem, we
measure the SSIM(Structural Similarity Index) and
MSE(Mean Square Error) values between the
original and the encrypted image(of each mode)

SSIM gives the degree of similarity between

images while MSE gives the degree of


dissimilarity. Thus we could define two
contrasting parameters to support our
cause.

SSIM Values

SSIM values
using
SSIM Value using only proposed
Mode Of AES
AES
system
ECB

0.019907587

0.016413107

CBC

0.011467977

0.012191389

CFB

0.012845624

0.011730625

OFB

0.011932028

0.011735661

CTR

0.010901383

0.009560976

Column graph for SSIM Values


0.03
0.02
SSIM Value
using only AES
SSIM values
using proposed
system

0.02
0.01
0.01
0

ECB

CBC

CFB

OFB

CTR

MSE Values
Mode of
AES

MSE value using


only AES

MSE value using


proposed system

ECB

57537.13911

57661.60757

CBC

61200.18457

61387.75557

CFB

61440.41335

61549.76558

OFB

61284.56683

61366.94688

CTR

61595.48264

61653.10451

Column graph for MSE values

MSE value using


only AES
MSE value using
proposed system

ECB

CBC

CFB

OFB

CTR

CONCLUSION

A simple and a robust method has been proposed


using a combination of block based random pixel
scrambling and encryption technique.

Results show that the SSIM value has decreased and


MSE value has increased when the proposed
algorithm was applied to the image..

Also it was noted that Counter(CTR) method was the


most efficient image encryption technique among all
the modes of AES.

REFERENCES

Reza Shakerian, Morisen Rahmarn, A New Modified


Version of Advanced Encryption Standard Based
Algorithm for Image Encryption International
Conference on Electronics & Information Engineering
(ICEIE 2010), (VI 141-VI 145) ,IEEE,2010

Jui-Cheng Yen, Jiun-In Guo, A New Chaotic Image


Encryption Algorithm , International Conference on
Computer Security, Department of Electronics
Engineering National Lien-Ho College of Technology and
Commerce, Miaoli, Taiwan, Republic of China, pp 124128,2007.

THANK YOU

Das könnte Ihnen auch gefallen