MATLAB-Simulink Implementation of AES Algorithm For Image Transfer
MATLAB-Simulink Implementation of AES Algorithm For Image Transfer
MATLAB-Simulink Implementation of AES Algorithm For Image Transfer
ISSN 1990-9233
IDOSI Publications, 2013
DOI: 10.5829/idosi.mejsr.2013.18.12.1003
MATLAB-Simulink Implementation of
AES Algorithm for Image Transfer
1
T. Saravanan, 1V. Srinivasan and 2R.Udayakumar
1
Deparment of ETC, Bharath University, Chennai, India
2
Department of IT, Bharath University, Chennai, India
Abstract: The best-known problem in the aspect of providing end-to-end secure communication is providing
Confidentiality, i.e. preventing the unauthorized from extraction of information over an insecure channel to
ensure privacy. Thus the use of the internet has fostered new interest in Cryptography. This paper presents
a challenging task of transferring the image to the destination with high confidentiality. The algorithm used is
Rijndael -128 which was approved as an Advanced Encryption Standard (AES). The proposed paper involves
design and simulation of AES-128 algorithm in MATLAB, which is perfectly suited for the matrix based data
structure of Rijndael algorithm. An AES encryptor is designed and implemented in MATLAB. An AES
decryptor is also designed and integrated with the AES encryptor to yield a full functional AES en/decryptor.
This algorithm is more applicable for security of complex imaging problems in disciplines such as aerospace and
defense, remote sensing, medical and scientific imaging.
Key words: Cipher Plaindata Cipherdata, Inverse Cipher, Key Expansion, Round Key, State Matrix.
1709
Middle-East J. Sci. Res., 18 (12): 1709-1712, 2013
Fig. 1: Input data converted to state matrix Fig. 2: Initial key converted to Key matrix
Each Round Description in Encryption Process: matrix shifting cyclically a certain number of bytes (Fig. 5).
SubBytes is a non-linear byte substitution operation The first row is left unchanged. The second row is left
designed to give the required amount of Confusion. It rotated by one byte, third row by two bytes and fourth
operates independently on each byte of the State matrix row by three bytes.
using a substitution table S-box (Fig. 4). To avoid attacks
based on simple algebraic properties, the S-box is Mix Column: Is a mixing operation designed to give the
constructed by combining the inverse function with an required amount of Intra-Word Diffusion. It operates on
invertible affine transformation [5-9]. each column of the State matrix individually, combining
the four bytes in each column using multiplications and
Shift Rows is a transposition step designed to give the additions in GF(28). Here matrix multiplication is done in
required amount of Inter-Word Diffusion. It operates which the new column is the product of the old column
individually on each of the last three rows of State and a constant matrix as shown below (Fig. 6).
1710
Middle-East J. Sci. Res., 18 (12): 1709-1712, 2013
Add Round Key: Is designed to provide Key Dependency Implementation of Aes Using Matlab: The image file taken
and Asymmetry. It operates independently on each byte for this paper is the gray level image file. MATLAB stores
of the State matrix by adding it with the corresponding gray images as two-dimensional arrays (i.e., matrices), in
byte of the Subkey using bitwise XOR. For each round, a which each element of the matrix corresponds to a single
Subkey is derived from the main key using the pixel in the displayed image. For example, an image
keyexpansion function. Each subkey has the same size as composed of 200 rows and 300 columns of different
the state matrix. intensity dots would be stored in MATLAB as a 200-by-
300 matrix. The Pixel values lies with in 0 to 255 and can be
Key Expansion: The key expansion function takes the represented by 8-bits i.e. one Byte. In this paper, three
user supplied 16 bytes long key and utilizes the round image files of sizes 120*160 pixels, 256*256 pixels and,
constant matrix rcon and the substitution table Sbox to 336*412 pixels are considered before encryption, after
generate a 176 byte long key schedule ek, which will be encryption and after decryption.
used during the encryption and decryption processes.
The 16 bytes of the key vector are rearranged (row-wise) Inialization Module: Here each round operation of AES is
into a 4 4 initial key matrix (k11 . . . k44). The basic done in modules. Before doing any actual en- or
principle of the KeyExpansion (Fig. 7) is an element-wise decryption, the initialization module initial (Fig.8) has to
XOR--sum of two rows, the direct predecessor row and be called once. This module generates the substitution
the row four rows up. The seventh row (k71 . . . k74) e. g. tables Sbox by a call to sbox_gen, defines the round
results from XORing the sixth row (k61 . . . k64) and the constant vector rcon and original key and computes the
third row (k31 . . . k34). Additionally every fourth row expanded key schedule ek . Additionally the two
(row 5, row 9 . . .) is created differently. The predecessor polynomial matrices that are used in MixColumn matrix are
row is rotated, substituted and XORed with also generated.
its corresponding round constant before applying the
XOR. Image Encryption Module: Main program module is
ImageEncryption (Fig. 8 ). This module takes the input as
Decryption Algorithm: Decryption is the process in image file, encrypts it and stores the encrypted image to
which the encrypted data is converted back to its original another file.The initialization step supplies the actual
form. The encryption structure in Fig. 3 can be inverted to encryption module(cipher) with the expanded key ek, the
get a straightforward structure for decryption. substitution tables sbox and inv_sbox and the polynomial
Corresponding to the transformations in the encryption, matrices mix_col_mat and inv_mix_col_mat. It then
InvSubBytes, InvShiftRows, InvMixColumns and receives the image file and the private key from the user,
AddRoundKey are the transformations used in the reads the image file and calculates its size( rows and
decryption. AddRoundKey is its own inverse, so the columns) so as to find the total number of pixels in an
same name is used. The round keys used are same as image. The image is then converted into a new matrix by
those in encryption generated by Key Expansion, but are rearranging each distinct 4-by-4 block of pixels in the
used in reverse order. image f into a column of b. Thus the number of 128 bit
1711
Middle-East J. Sci. Res., 18 (12): 1709-1712, 2013
CONCLUSION
1712