a hybrid approach for image security by combining
TRANSCRIPT
A Hybrid Approach For Image Security By CombiningCryptography and Steganography
A PROJECT REPORT
Submitted by
CH. SAMPATH 316126510133
A. ADITYA 316126510122
P. SUNIL KUMAR 316126510103
A. AKHILESH 316126510121
in partial fulfilment for the award of the degree
of
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE ENGINEERING
Under the esteemed guidance of
G. GAYATHRI
ASSISTANT PROFESSOR
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY & SCIENCES
(AUTONOMOUS)
(Permanently Affiliated to Andhra University)
SANGIVALASA: VISAKHAPATNAM – 531162
ANIL NEERUKONDA INSTITUTE OF TECHNOLOGYAND SCIENCES
(AUTONOMOUS)
(Permanently Affiliated to Andhra University)
SANGIVALASA, VISAKHAPATNAM-531162
BONAFIDE CERTIFICATE
Certified that this project report “A HYBRID APPROACH FOR IMAGE
SECURITY BY COMBINING CRYPTOGRAPHY AND
STEGANOGRAPHY” is the Bonafide work of “CH.SAMPATH
316126510133, A.ADITYA 316126510122, P.SUNILKUMAR 316126510103,
A.AKHILESH 316126510121” who carried out the project work under my
supervision.
SIGNATURE SIGNATURE Dr. R. SIVARANJANI G. GAYATHRI HEAD OF THE DEPARTMENT PROJECT GUIDE PROFESSOR ASSISTANT PROFESSOR DEPT. OF CSE DEPT. Of CSE ANITS ANITS
DECLARATION
This is to certify that the project work entitled A Hybrid Approach For
Image Security By Combining Cryptography And Steganography is a
bonafide work carried out by CH. Sampath, A. Aditya, P. Sunil Kumar, A.
Akhilesh as a part of B.TECH final year 2nd semester of Computer Science &
Engineering of Andhra University, Visakhapatnam during the year 2016-2020.
We, CH. Sampath, A. Aditya, P. Sunil Kumar, A. Akhilesh, of final
semester B.Tech., in the department of Computer Science Engineering from
ANITS, Visakhapatnam, hereby declare that the project work entitled A Hybrid
Approach For Image Security By Combining Cryptography And
Steganography is carried out by us and submitted in partial fulfillment of the
requirements for the award of Bachelor of Technology in Computer Science
Engineering , under Anil Neerukonda Institute of Technology & Sciences during
the academic year 2016-2020 and has not been submitted to any other university
for the award of any kind of degree.
CH. SAMPATH 316126510133
A. ADITYA 316126510122
P. SUNIL KUMAR 316126510103
A. AKHILESH 316126510121
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful
completion of task would be incomplete without the mention of the people
who made it possible, whose constant guidance and encouragement
always boosted the morale. We take a great pleasure in presenting a
project, which is the result of a studied blend of both research and
knowledge.
We first take the privilege to thank the Head of our Department,
Dr.R.Sivaranjani, for permitting us in laying the first stone of success and
providing the lab facilities, we would also like to thank the other staff in
our department and lab assistants who directly or indirectly helped us in
successful completion of the project.
We feel great to thank G. Gayathri, who is our project guide and
who shared her valuable knowledge with us and made us understand the
real essence of the topic and created interest in us to work day and night
for the project; we also thank our B.Tech coordinator Dr. K.Selvani
Deepthi, for her support and encouragement.
We also like to thank Mrs.B.V. Udaya Lakshmi who extended their
part of support in the successful completion of the project.
CH. SAMPATH 316126510133
A. ADITYA 316126510122
P. SUNIL KUMAR 316126510103
A. AKHILESH 316126510121
ABSTRACT
Cyber crime has become a dangerous threat to all the technical users
and layman. Due to lack of skill on using the secured means in the data
communication, many users as well as organizations are suffering. As we
know that India is moving a step ahead in technical aspects, which is
enhancing and improving the concept “Digital India”, but we must intensify
the concept to “Secure Digital India” where we can see no data breaches, no
malicious attacks and no cyber terrorism. Security in transmission through
the public channels, storage of digital images has its importance in today's
image communications and confidential video conferencing. Because of
expanding use in sharing the images in the daily social life, it is essential to
protect the confidential image data from unauthorized access. Advanced
Encryption Standard (AES), a block cipher based algorithm is a well famous
methodology making several advantages in data encryption. We are doing a
hybrid approach for image security that combines both encryption of the
image data and hiding the encrypted data into another image through
steganography. The research helps layman to share the images into the
public channels without getting compromised.
KEYWORDS : Cryptography, Steganography, Encryption, Decryption,
AES, LSB, Hiding-Extracting, Cyber security, Image security, Cyber
threats.
LIST OF FIGURES
Fig. 1.1 Cryptography system
Fig.1.2 Steganography system
Fig.2.1 AES rounds
Fig.3.1.1.1 Sender side architecture
Fig.3.1.1.2 Receiver side architecture
Fig.3.1.2.6 Module flow
Fig.4.1 Structure chart
Fig.4.2.1 Class diagram
Fig.4.2.2 Use Case Diagram
Fig.4.2.3.1 Activity Diagram - sender
Fig.4.2.3.2 Activity Diagram - receiver
Fig.4.2.4.1 Sequence Diagram - sender
Fig.4.2.4.2 Sequence Diagram - receiver
Fig.4.2.5.1 State chart diagram – sender
Fig.4.2.5.2 State chart diagram - receiver
Fig.4.1.2.5 Component diagram
Fig.4.1.2.6 Deployment diagram
Fig.5.3.1 Output of the encryption
Fig.5.3.2 Output of the Decryption
Fig.5.4.1 LSB hiding
Fig.5.4.2 LSB extracting
TABLE OF CONTENTS
TITLE PAGE NUMBER
Abstract i
Keywords i
List of Figures ii
1. INTRODUCTION 1
1.1 Cryptography 1
1.1.1 Symmetric / Secret Key Cryptography 2
1.1.2 Asymmetric / Public Key Cryptography 2
1.2 Steganography 2
1.3 Steganography vs Cryptography 3
1.4 Combination of Steganography and Cryptography 4
1.5 Motivation for the work 5
1.6 Problem Statement 6
1.7 Organization of the thesis 6
2. LITERATURE SURVEY 8
2.1 AES Algorithm 8
2.2 LSB Technique 11
2.3 Existing methods for Encryption and Steganography 12
3. METHODOLOGY 16
3.1 Proposed System 16
3.1.1 System Architecture 16
3.1.2 Modules 18
3.1.2.1 Image to pixel data 18
3.1.2.2 Encrypt pixel values 18
3.1.2.3 Hide encrypted data 19
3.1.2.4 Extract encrypted data 19
3.1.2.5 Decrypt encrypted pixel data 19
3.1.2.6 Pixel data to Image 19
4. DESIGN 21
4.1 Structure Chart 21
4.2 UML Diagrams 22
4.2.1 Class Diagram 23
4.2.2 Use Case Diagram 24
4.2.3 Activity Diagram 25
4.2.4 Sequence Diagram 27
4.2.5 State chart Diagram 29
4.2.6 Component Diagram 31
4.2.7 Deployment Diagram 32
5. EXPERIMENTAL ANALYSIS AND RESULTS 33
5.1 System Configuration 33
5.1.1Software Requirements 33
5.1.2Hardware Requirements 33
5.2 Sample Code 34
5.3 Screenshots 78
5.4 Experimental Analysis/Testing 82
6. CONCLUSION AND FUTURE WORK 85
6.1 Conclusion 85
6.2 Future Work 85
REFERENCES 86
1. INTRODUCTION
Cyber Security is the body of technologies, whose processes and practices are drafted to
protect networks. Apart from detecting the already existing threat, it also uses the
intrusion prevention methods, in order to avert the upcoming threats.
In order to avert threat, virus or any unauthorized access into a network or a computer,
we need to safeguard the network with a firewall and awareness of hacking. It is
important to avert security breach which can cause diminution for an organization.
Potential threats like loss, modification, unauthorized access, data leak must be
prevented.
1.1 Cryptography
To corroborate the confidentiality, integrity and availability of information, it is vital to
secure the information. One pivotal branch of information security is cryptography, the
science of securing the data. Cryptography permits the original data to be converted into
cipher data that can be sent over the unsecure channel. Fig.1. shows the representational
diagram of the steps followed by sender and receiver using cryptography. Encryption is
the procedure of transforming the native data into cryptographic data so that only
intended recipient can decipher the data by applying decryption.
Fig. 1.1 Cryptography (Ref-2)
1
1.1.1 Symmetric / Secret Key Cryptography
The strategy of Secret key (same to sender and receiver) encryption can also be known as
the symmetric-key, shared key, single-key, and eventually private-key encryption. The
technique of private key uses for all side's encryption and decryption secret data. The
original information or plaintext is encrypted with a key by the sender side also, the same
key is used by the receiver to decrypt the encrypted data to obtain the plaintext. the key
will be known only by the people who are legitimize to the modules of
encryption/decryption. However, the technique pledges the good security for transmission
but there is a difficulty with the distribution of the key. if one nab or explore the key he
can get whole data without any difficulty. An example of Symmetric Key cryptography
methodology is DES Algorithm.
1.1.2 Asymmetric / Public Key Cryptography
We can call this system as the asymmetric cryptosystem or public key cryptosystem, this
uses two keys which are mathematically associated, use separately for encrypting and
decrypting the knowledge. During this technique, once we use the private key, there are
not any possibilities to get the info or just discover the opposite key, all keys are needed
for the technique to run. The key used for encryption is stored public, ergo it’s called
public key, and therefore the decryption key's stored secret and called private key. An
example of Asymmetric-Key Algorithms is RSA.
1.2 Steganography
Steganography is the branch of information security that enables the information hiding.
It is the art and science of hiding the data within a cover in order to avoid disruption,
modification and disclosure etc. Steganography differs from cryptography in the sense
that it keeps the existence of information secret while cryptography keeps contents of
information secret. Fig.2. describes the steganography process. Embedding is the process
2
of hiding a secret message within a cover. A great deal of attention is required so that
secret message goes unnoticed if third party intercepts the message. Extracting is the
inverse of embedding process where secret message is revealed at the end.
Fig.1.2 Steganography system - (Ref-2)
1.3 Steganography vs Cryptography
Steganography and Cryptography are used for the purpose of data transmission over an
insecure network without the data being exposed to any unauthorized persons.
Steganography embeds the data in a cover image while cryptography encrypts the data.
The advantage of steganography is that the look of doubt for the attacker to suspect the
file isn't changed and ibis it will not raise any that there may be some data hidden unlike
cryptography that encrypts the data and sends it to over the network.
3
Table 1.3 (Ref-3)
1.4 Combination of Steganography and Cryptography
It is noted that steganography and cryptography alone is insufficient for the security of
information, therefore If we combine these systems, we can generate more reliable and
strong approach.
The combination these two strategies will improve the security of the information secret.
This combined will fulfil the prerequisites, for example, memory space, security, and
strength for important information transmission across an open channel.
4
Also, it will be a powerful mechanism which enables people to communicate without
interferes of eavesdroppers even knowing there is a style of communication in the first
place.
1.5 Motivation for the work
As technology expanded, users started migrating information into digital form. It is
difficult to secure these digital data from hackers while sending or receiving files from
another person over the internet. So we need some secure method to communicate that’s
the main reason for developing this tool. This proposed tool will eliminates user effort of
using different tools.
Cyber Threats
The below listed cyber threats have been mainly used to compromise the image data that
is been sent in the public medium. The increase in the number of attacks lack of security
in image security has motivated us to do research on this domain.
♦ Keylogging: Also familiar as Keystroke logging. It is the method when a attacker
records the key-storks while the victim is unaware of it. It can be done via malicious
application which is specifically coded for these purposes. This is a kind of spyware,
where attacker spies to collect the keystrokes of Usernames and Passwords.
♦ Sniffing : Monitoring and capturing the packets passing through a network and
analyzing it. It is also called WireTapping. Sniffing is important to study the packets. To
secure ourselves, we must use encrypted network and SSL is recommended (Secure
Socket Layer) in the web address. Email Traffic, FTP passwords, Web Traffics, Chat
sessions, Cookies, DNS traffic etc can be sniffed. Sniffing can help attackers to perform
ARP Poisoning, Spoofing Attacks, DHCP Attacks, etc.
Some of the most popular Sniffing tools are WireShark, SmartSniff [4].
5
♦ MITM: “Man In The Middle Attack” is an attack in which attacker enters the field of
communication by sniffing and spoofing methodology and secretly relays and alters the
communication between two parties who believe that they are directly communicating to
each other. The elemental strategy is to disconnect the single connection between server
and client, alter between both the networks and use the cookies and other info to harm. In
order to safeguard from MITM, end-to-end encryption, SSL etc. are introduced.
1.6 Problem Statement
The aim of the project is to ensure image security by first encrypting the target image
with an modified version of AES algorithm and then using steganography to hide the
encrypted image in a bigger image, which is then sent to the destination.
1.7 Organization of the thesis
The introduction gives a brief about the work domain and the basic knowledge on the
project. The next chapters are explained as below -
Chapter 2, Literature survey gives the usage algorithms and the methods that are been
used in the system. Along with the existing methods of Encryption and Steganography.
Chapter 3, Methodology provides the system architecture and the module division of the
system with the explanantion of each module in brief.
Chapter 4, Design of the project produces the structure chart and other UML diagrams of
the project.
6
Chapter 5, Experimental analysis produces the results that are obtained in the system for
various inputs. Along with the software and hardware requirements. The sample code of
the system is also present in this chapter.
Chapter 6, Conclusion is given in justification to the work done in the project that is
accomplished by the system with a future work note.
7
2. LITERATURE SURVEY
The significance of network security is increased day by day as the size of data being
transferred across the Internet. This issue pushes the researchers to do many studies to
increase the ability to solve security issues. A solution for this issue is using the
advantage of cryptography and steganography combined in one system. many studies
propose methods to combine cryptography with steganography systems in one system.
these methods were deceased in previous surveys available on the topic. This survey was
published in 2014, it aims to give an overview of the method proposed to combine
cryptography with steganography systems. In this survey, the authors introduced 12
methods which are combined steganography and cryptography and made a comparative
analysis. This comparative has been implemented on the basis of the requirements of
security i.e. authentication, confidentiality, and robustness. Another survey was published
in 2014, this survey presented many steganographic techniques combined with
cryptography, AES Algorithm, Alteration Component, Random Key Generation,
Distortion Process, Key Based Security Algorithm.
There has been a continuous rise in the number of data security threats in the recent past
and it has become a matter of concern for the security experts. Cryptography and
steganography are the best techniques to nullify this threat. The researchers today are
proposing a blended approach of both techniques because a higher level of security is
achieved when both techniques are used together.
2.1 AES Algorithm
Advanced Encryption Standard is a symmetric block cipher encryption algorithm that
uses a single key to encrypt the data.
Encryption Process
8
Here, we restrict to description of a typical round of AES encryption. Each round
comprise of four sub-processes except for the last and final round of the algorithm. In the
last round of the AES algorithm we will remove one of the transformation called mix
column transformation. The first round process is depicted below.
Byte Substitution (SubBytes)
The 16 input bytes are substituted by looking up a tough and fast table (S-box) given in
design. the result is during a matrix of 4 rows and 4 columns.
Shiftrows
Each of the four rows of the matrix is shifted to the left(except the 1st one). Any entries
that ‘fall off’ are re-inserted on the right side of row. Shift is run as follows −
1. First row isn't shifted
2. Second row is shifted one(byte) position to the left
3. Third row is shifted two positions to the left
4. Fourth row is shifted three positions to the left
The result's a replacement matrix consisting of the same 16 bytes but shifted with regard
to each other .
Fig.2.1 AES rounds
9
MixColumns
Each column of 4 bytes is now converted employing a special function . This function
takes as input the four bytes of 1 column and outputs four completely new bytes, which
replace the primary column. the result is another new matrix consisting of 16 bytes. It
should be noted that this step isn't performed within the last round.
Addroundkey
The 16 bytes of the matrix are now considered as 128 bits and are XORed to the 128 bits
of the round key. If this is often often the last round then the output is that the ciphertext.
Otherwise, the resulting 128 bits are interpreted as 16 bytes which we start another
similar round.
Decryption Process
The process of decryption of an AES ciphertext is analogous to the encryption process
within the reverse order. Each round consists of the four processes conducted within the
reverse order −
1. Add round key
2. Mix columns
3. Shift rows
4. Byte substitution
Since sub-processes in each round are in reverse manner, unlike for a Feistel Cipher, the
encryption and decryption algorithms must be separately implemented, although they're
very closely related.
10
2.2 LSB Technique
Images are ideal for information hiding due to the massive amount of dispensable space
is made within the storing of images.
The most common and popular method of modern-day steganography is to form use of
LSB of picture’s pixel information. This system works best when the file is longer than
the message file and if image is graysscale. When applying LSB techniques to every byte
of a 24bit image, three bits are often encoded into each pixel. If the LSB of the pixel
value of canopy image C(i,j) is adequate to the message bit SM of secret message to be
embedded, C(i,j) remain unchanged, if not set the LSB of C(i,j) to SM.
Message embedding process is given:
S(i,j) = C(i,j) – 1, if LSB(C(i,j)) = 1 and SM = 0.
S(i,j) = C(i,j) + 1, if LSB(C(i,j)) = 0 and SM = 1.
S(i,j) = C(i,j) , if LSB(C(i,j)) = SM
Where LSB(C(i,j)) stands for the LSB of canopy image C(i,j) and “SM” is that the next
message bit to be embedded. S(i,j) is that the stego image. Many variations of this LSB
algorithm are often used one such example is given below-
We can use images to hide things if we replace the last bit of every colors byte with a bit
from the message.
Message A- 01000001
Image with 3 pixels
Pixel 1: 11011000 11001001 00000011
Pixel 2: 11011000 11001001 00000011
Pixel 3: 11011000 11001001 00000011
Now we hide our message in the image.
Message: 01000001
Pixel 1: 11011000 11001001 00000010
11
Pixel 2: 11011000 11001000 00000010
Pixel 3: 11011000 11001001 00000011
2.3 Existing methods for Encryption and Steganography
In [4], proposed an encrypting technique by combining cryptography and steganography
techniques to hide the data. In cryptography process, they proposed an effective
technique for data encryption using one’s complement method, which we called as
SCMACS. It used a symmetric key method where both sender and receiver share the
same key for encryption and decryption. In steganography part, we used the LSB method
that is used and mostly preferred.
In [5], authors proposed a highly-secured steganography technique by combining DNA
sequence with Hyperelliptic Curve Cryptography. This approach executes the benefits of
both techniques to afford a high level of security communication. Also, it uses the
benefits of both DNA cryptography and Steganography. This algorithm tries to hide a
secret image in another cover image by convert them into DNA sequence using the
nucleotide to the binary transformation table. On the sender side, the embedding method
includes three steps. First, they convert the values of a pixel of both the cover image and
secret image to their respective DNA triplet value utilizing characters to the DNA triplet
conversion. Secondly, they convert the triplet values to binary values format. In the final
stage, apply the XOR logic between binary values of both secret image and cover image
to generate a new image which called stego image.
In [6], authors presented a new technique called multi-level secret data hiding which
integrates two different methods of encryption namely visual cryptography and
steganography. The first step of this method thy used a method called halftoning which is
used to reduce the pixels and simplify the processing. After that visual cryptography is
performed that produces the shares which form the first level of security and then
12
steganography in which thy used the LSB method to hide the shares in different media
like image, audio, and video.
The paper at [7] presented a method based on combining both the strong encrypting
algorithm and steganographic technique to make the communication of confidential
information safe, secure and extremely hard to decode. An encryption technique is
employed for encrypting a secret message before encoding it into a QR code. UTF-8
format is converted into base64 format to make it compatible for further processing. The
encoded image is scrambled to achieve another security level. The scrambled QR code is
finally embedded in a suitable cover image, which is then transferred securely to deliver
the secret information. They utilized a least significant bit method to accomplish the
digital image steganography. At the receiver’s side, the secret data is retrieved through the
decoding process. Thus, a four-level security has been rendered for them a secret message
to be transferred.
In [8] authors presented an image steganography method. At first, they used the DES
algorithm to encrypt the text message. They used a 16 round and with block size 64-bit.
After that the K-Means Clustering of The Pixels method which clusters the image into
numerous segments and embedded data in every segment. There are many clustering
algorithms use for image segmentation. Segmentation includes a huge set of information
in the form of pixels, where every pixel additional has three components namely red,
green and blue(RGB). After the formation of clusters, the encrypted text is separated into
K number of segments. These segments are to be hidden in each cluster. They used the
LSB (Least Significant Bit) method for this purpose.
In [9], authors presented a method to extend the embedding capacity and to enhance the
quality of stego image. The Adaptive Pixel Value Differencing which is an improved
form of Pixel Value Differencing was utilized as the Steganographic system although
AES was utilized as the Cryptographic system. In this method, they used an image as a
cover to hide the secret data inside. This cover should be a grayscale image. therefore,
13
pixel size must be 256*256. If the size of a pixel was high, they brought it to this range.
They checked if the cover image is a colour image they changed it into the grayscale
range. They used APVD algorithm to embed the data into the cover image. The result
gotten after hiding the data called stego image. They used AES algorithm to encrypt stego
image.
In [10], authors conducted a performance analysis survey on various algorithms like
DES, AES, RSA combining with LSB substitution technique which serves well to draw
conclusions on the three encryption techniques based on their performances in any
application. It has been concluded from their work that AES encryption is better than
other techniques as it accounts for less encryption, decryption times and uses less buffer
space.
In [11], authors performed a modern method in which use Huffman encoding to hide
data. They took a gray level image of size m*n as cover image and p*q as a secret image.
After that, they executed the Huffman encoding over the secret image and every bit of
Huffman code of a secret image is hidden into a cover image utilizing LSB algorithm.
In [12], authors suggested a new steganographic technique based on gray-level
modification for true color images using a secret key, cryptography and image
transposition. Both the secret key and secret information are firstly encrypted using
multiple encryption algorithms (bitxor operation, stego key-based encryption, and bits
shuffling); these are, later, hidden in the cover image pixels. In addition, the input image
is changed before data hiding. Image transposition, bitxoring, stego key-based
encryption, bits shuffling, and gray-level modification introduces five various security
levels to the suggested technique, making the recovery of data is very difficult for
attackers.
In [13], the authors encrypted the secret data by use AES algorithm and hashed the key
using SHA-1 to prevent from attacks. After that, they used the LSB technique to embed
14
the encrypted information in image, video or audio. The receiver must implement the key
which is hashed in sender side. The secret data can be hidden in any type of media which
affords more security.
In [14], authors proposed a new method. First, the secret message is changed into cipher
text using RSA algorithm and next they hide the cipher text in audio using LSB audio
steganography technique similarly. At receiver, first, cipher text is extracted from audio
then decrypted it into a message by using RSA decryption. So, this technique combines
the characteristic of both cryptography and steganography and provides a higher level of
security.
In [15], authors used BLOWFISH cryptography Algorithm to encrypt a secret image.
Because BLOWFISH is faster and stronger, provides good performance when compared
with RC6, RC4, DES, 3DES, AES. They selected a secret image in BMP format and
encrypted by BLOWFISH algorithm. Then, they used LSB technique to embed encrypted
image into video frames using. This method affords authenticity, integrity, confidentiality
and non-repudiation.
15
3. METHODOLOGY
3.1 Proposed System
3.1.1 System Architecture
A system architecture or systems architecture is the conceptual model that defines the
structure, behavior, and more views of a system. The defined system architectures are
been categorized as the sender and the receiver.
Sender Architecture
Fig.3.1.1.1 Sender side (Ref-1)
The sender architecture begins with the input as the secret image, cover image and the
key; and the output is the cover image that contains the secret image which is hidden in
the encrypted form.
16
Receiver architecture
Fig.3.1.1.2 Receiver side (Ref-1)
At the receiver side the architecture begins with the input as the cover image (with steg
hidden secret image) and the key; and the output is the secret image that is been hidden
by the sender.
Secure and authenticated key establishment in our system occurs in three main phases:
At sender:
Conversion of Image to Pixel data.
Encrypting the pixel data using the AES algorithm.
Hiding the encrypted data using the LSB steganography method.
17
At receiver:
Conversion of Image to Pixel data.
Decrypting the data using the AES algorithm.
Extracting the decrypted data using the LSB steganography method.
3.1.2 Modules
3.1.2.1 Image to pixel data 10%
Taking the input file of the image, it is converted into the pixel data using the
python file handling functions.
The image size is taken to be 128 bits. This image file is then given as input to the
python file that uses the PIL (Python Imaging Library) in the python to convert into the
pixels of data. This particular conversion of the image into the pixels is stored in a file.
These pixels values are then given as input to the AES algorithm for encryption with the
provided key by the user (sender).
3.1.2.2 Encrypt pixel values 20%
This module includes the encryption of the pixel data, that is the module deals
with the encryption of the image.
The pixel data generated is been taken into a file. The data is given as input to the
AES algorithm code. The AES programmed is of 128 bits, hence the input taken is taken
as 16 Byte data each time. The block of 16 Byte taken by the AES program with the
given key of 16 Bytes produces the encrypted data.
18
3.1.2.3 Hide encrypted data 20%
The module deals with the hiding of the generated data by the encryption
algorithm in the encryption module.
This is done using the Steganography methods to hide the encrypted data into the
cover image which is given as the key to the Steganography function. The encrypted data
will be hidden using LSB Method. In the LSB method, the least significant bit of every
pixel in the cover image is used to store the data bits of the secret image encrypted pixel
data bits.
3.1.2.4 Extract encrypted data 20%
The module deals with the extracting of data from the Cover image by using LSB
Method. The Least Significant Bit of every pixel from the Cover Image will be taken and
store the data bits.
3.1.2.5 Decrypt encrypted pixel data 20%
In this module, the extracted data bits will be decrypted using AES algorithm.
The extracted data that is obtained will be in the form of encrypted pixel data, this
will be decrypted using AES algorithm and the output will be in the original image of
pixel data.
3.1.2.6 Pixel data to Image 10%
This is the final module which deals with the conversion of the decrypted data
given to the file handlers to generate the original secret image at the receiver side.
19
4. DESIGN
4.1 Structure chart
Fig.4.1 Structure chart
A structure chart (SC) in software engineering and organizational theory is a chart which
shows the breakdown of a system to its lowest manageable levels. They are used in
structured programming to arrange program modules into a tree.
21
4.2 UML Diagrams
A UML diagram is a partial graphical representation (view) of a model of a system
under design, implementation, or already in existence. UML diagram contains graphical
elements (symbols) - UML nodes connected with edges (also known as paths or flows) -
that represent elements in the UML model of the designed system. The UML model of
the system might also contain other documentation such as use cases written as templated
texts.
The kind of the diagram is defined by the primary graphical symbols shown on the
diagram. For example, a diagram where the primary symbols in the contents area are
classes is class diagram. A diagram which shows use cases and actors is use case
diagram. A sequence diagram shows sequence of message exchanges between lifelines.
UML specification does not preclude mixing of different kinds of diagrams, e.g. to
combine structural and behavioral elements to show a state machine nested inside a use
case. Consequently, the boundaries between the various kinds of diagrams are not strictly
enforced. At the same time, some UML Tools do restrict set of available graphical
elements which could be used when working on specific type of diagram.
UML specification defines two major kinds of UML diagram: structure
diagrams and behavior diagrams.
Structure diagrams show the static structure of the system and its parts on different
abstraction and implementation levels and how they are related to each other. The
elements in a structure diagram represent the meaningful concepts of a system, and may
include abstract, real world and implementation concepts.
Behavior diagrams show the dynamic behavior of the objects in a system, which can be
described as a series of changes to the system over time.
22
4.2.1 Class Diagram
Fig.4.2.1 Class diagram
The class diagram in the Unified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among objects.
In this scenario, the system consists of two main classes; Cryptography and
Steganography. The Cryptography class has two sub classes; Encryption and Decryption
classes.
23
4.2.2 Use Case Diagram
Fig.4.2.2 Use Case Diagram
A use case diagram at its simplest is a representation of a user's interaction with the
system that shows the relationship between the user and the different use cases in which
the user is involved. In this system, the use case diagram represents the primary actors as
the sender and the receiver. Each primary actor is represented with the respective
functions that are defined inside the system scope.
24
4.2.3 Activity Diagrams
In this system, there are two activity diagrams, one for the sender and the other for the
receiver.
Fig.4.2.3.1 Activity Diagram - sender
Activity diagram is defined as a UML diagram that focuses on the execution and flow of
the behaviour of a system instead of implementation. It is also called object-oriented
flowchart. Activity diagrams consist of activities that are made up of actions which apply
to behavioural modelling technology.
25
Fig.4.2.3.2 Activity Diagram - receiver
The activity diagram of the sender starts from the point of giving the inputs as key and
the cover image and secret image pair to the system and terminates at the production of
the output steg- hidden image. Similarly, the receiver side starts with the input as the
steg-hidden image to the system and terminates at the display of the secret image.
26
4.2.4 Sequence Diagrams
Fig.4.2.4.1 Sequence Diagram - sender
A sequence diagram shows object interactions arranged in time sequence. It depicts the
objects and classes involved in the scenario and the sequence of messages exchanged
between the objects needed to carry out the functionality of the scenario.
27
Fig.4.2.4.2 Sequence Diagram - receiver
In this system, there are two sequence diagrams, one which explains the sequence of
tasks done by the sender, and the other about the receiver.
28
4.2.5 State chart diagrams
Sender
Fig.4.2.5.1 State chart diagram – sender
Statechart diagram is one of the five UML diagrams used to model the dynamic nature of
a system. They define different states of an object during its lifetime and these states are
changed by events. Statechart diagrams are useful to model the reactive systems.
29
Receiver
Fig.4.2.5.2 State chart diagram - receiver
In this system, we have two state chart diagrams. Each diagram explains the states
transitions in the sender and the receiver side.
30
4.2.6 Component diagram
Fig.4.1.2.5 Component diagram
A component diagram, also known as a UML component diagram, describes the
organization and wiring of the physical components in a system. Component diagrams
are often drawn to help model implementation details and double-check that every aspect
of the system's required functions is covered by planned development.
31
4.2.7 Deployment diagram
Fig.4.1.2.6 Deployment diagram
A UML deployment diagram is a diagram that shows the configuration of run time
processing nodes and the components that live on them. Deployment diagrams is a kind
of structure diagram used in modeling the physical aspects of an object-oriented system.
32
5. EXPERIMENTAL ANALYSIS AND RESULTS
5.1 System configuration
5.1.1 Software Requirements
1. Python 3.x
2. Windows 7/8/8.1/10 or Ubuntu 16.04 or latest versions
5.1.2 Hardware Requirements
1. 32-bit Intel Pentium 4 or compatible processor running at 2 GHz or greater
2. 512 MB RAM
3. Disk space: 300 MB for client components
33
5.2 Sample code
5.2.1 Image to Pixel Data Module
from PIL import Image
if __name__ == "__main__":
im = Image.open("128.jpeg","r")
im = im.convert("RGB")
pix_data = list(im.getdata())
print("image data ======== ",pix_data,len(pix_data))
strr = ''
for i in pix_data:
for j in i:
t = str(j)
if(len(t)!=3):
rem = 3-len(t)
for k in range(rem):
t = '0'+t
#print("t === ",t)
strr+=t
print("===========================================================
======")
print("string of pixels == ",strr)
f= open("string.txt","w")
f.write(strr)
f.close()
print("===========================================================
======")
34
#the below code is for converting pixel data back to image
'''new = Image.new("RGB",(128,128))
new.putdata(pix_data)
new.save("for.jpeg")'''
5.2.2 Pixel Data Encryption Module
import base64
from aes128_enc import *
from aes128_dec import *
#----------------------------------------------------------------------
def check(temp):
if(len(temp)==16):
return temp
elif(len(temp)!=16):
rem = 16-len(temp)
for i in range(rem):
temp+='a'
return temp
#-----------------------------------------------------------------------
if __name__ == "__main__":
#message = input("enter 16 byte msg = ")
k = "hello world 1234"#input("enter 16byte key = ")
word = [0]*44
key_gen(k,word)
temp = " "
mainstr = ''
base_str =""
f= open("string.txt","r")
g = open("base64hide.txt","w")
35
h = open("final.txt","w")#test
j = open("base64.txt","w")
count = 8000
i = 0
while(temp!=''):
print("+++++++++++++++++++++++++++ round ",i,"+++++++++++++++++
++++++++++++++")
temp = str(f.read(16))
if(len(temp)==0):
break
temp = check(temp)
print("before encryption = ",temp)
c = encryption(temp,word)
mainstr+=c
print("type of c == ",type(c))
strr = base64.b64encode(c.encode("utf-8"))
base_str+=str(strr)
strr = str(strr)+'\n'
print("type of strr ",type(strr))
j.write(strr)
print("strr,length ====== ",strr,len(strr))
print("after encryption = ",c)
k = decrypt(c,word)
print("decrypt == ",k)
#g.write(str(c))
h.write(k)
count-=1
i+=1
print("length of string == ",len(base_str))
print("my string === ",base_str)
36
g.write(base_str)
f.close()
g.close()
h.close()
j.close()
#g.write(mainstr)
'''k = open("en_txt.txt","r")
temp = " "
while temp!="":
temp = k.read()
print("textfile = ",temp)'''
aes128_enc.py:
s_box = (
(0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE,
0xD7, 0xAB, 0x76),
(0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C,
0xA4, 0x72, 0xC0),
(0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71,
0xD8, 0x31, 0x15),
(0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB,
0x27, 0xB2, 0x75),
(0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29,
0xE3, 0x2F, 0x84),
(0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A,
0x4C, 0x58, 0xCF),
37
(0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50,
0x3C, 0x9F, 0xA8),
(0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10,
0xFF, 0xF3, 0xD2),
(0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64,
0x5D, 0x19, 0x73),
(0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE,
0x5E, 0x0B, 0xDB),
(0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91,
0x95, 0xE4, 0x79),
(0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65,
0x7A, 0xAE, 0x08),
(0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B,
0xBD, 0x8B, 0x8A),
(0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86,
0xC1, 0x1D, 0x9E),
(0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE,
0x55, 0x28, 0xDF),
(0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0,
0x54, 0xBB, 0x16)
)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
rcon = (0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x1B,0x36)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
38
def add_round_key(word,state,round_no):
#print("//////////////////////////////////////////ADD ROUND
KEY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
ll = round_no*4
ul = ll+3
index = 0
for j in range(ll,ul+1):
#print("state[",index,"] , word[",j,"][",0,"] , index =====
",state[index],word[j][0],index)
state[index] = hex(int(state[index],16)^int(word[j][0],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
#print("state[",index,"] , word[",j,"][",1,"] , index =====
",state[index],word[j][1],index)
state[index] = hex(int(state[index],16)^int(word[j][1],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
#print("state[",index,"] , word[",j,"][",2,"] , index =====
",state[index],word[j][2],index)
state[index] = hex(int(state[index],16)^int(word[j][2],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
#print("state[",index,"] , word[",j,"][",3,"] , index =====
",state[index],word[j][3],index)
state[index] = hex(int(state[index],16)^int(word[j][3],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
39
#----------------------------------------------------------------------------------------------------------
--------------------------
def substitute_bytes(state):
#print("//////////////////////////////////////////SUBSTITUTE
BYTES\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
#print("state_before_subbytes = ",state)
for i in range(16):
k = int(state[i],16)
bin_val = format(k,"08b")
l_index = int(bin_val[:4],2)
r_index = int(bin_val[4:],2)
state[i] = hex(s_box[l_index][r_index])
#print("state_after_subbytes = ",state)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def shiftrows(state):
#print("//////////////////////////////////////////SHIFTROWS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\")
temp = [[0 for i in range(4)]for i in range(4)]
count=0
for i in range(4):
for j in range(4):
temp[j][i] = state[count]
count+=1
#print("-------------befor shiftrows------------------")
#for i in range(4):
#print(temp[i])
40
temp[1] = [temp[1][1],temp[1][2],temp[1][3],temp[1][0]]
temp[2] = [temp[2][2],temp[2][3],temp[2][0],temp[2][1]]
temp[3] = [temp[3][3],temp[3][0],temp[3][1],temp[3][2]]
#print("-------------after shiftrows------------------")
#for i in range(4):
#print(temp[i])
count = 0
for i in range(4):
for j in range(4):
state[count] = temp[j][i]
count+=1
#print("----------------state after shifrows-----------------")
#print(state)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def leftshift(temp):
t = format(temp,"08b")
t = t[1:]+'0'
return int(t,2)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def rijndael(mat,temp):
if(mat == 1):
#print("Entered value ========= 01")
return temp
41
elif(mat == 2):
#print("Entered value ========= 02")
t1 = format(temp,"08b")
if(t1[0]=='1'):
#print("enterd condition 02 ------ 1")
t2 = leftshift(temp)
#print("left shift ",temp," == ",t2)
t2 = t2 ^ int("0x1b",16)
#print("xor with 1b == ",t2)
return t2
elif(t1[0]=='0'):
#print("enterd condition 02 ------ 0")
t2 = leftshift(temp)
#print("left shift ",temp," == ",t2)
return t2
elif(mat == 3):
#print("Entered value ========= 03")
t1 = format(temp,"08b")
if(t1[0] == '1'):
#print("entered condition 03 ------ 1")
t2 = leftshift(temp)
#print("left shift ",temp," == ",t2)
t2 = t2^int("0x1b",16)
#print("xor with 1b == ",t2)
t2 = (t2)^temp
#print("t2 xor with temp == ",t2)
return t2
elif(t1[0] == '0'):
#print("entered condition 03 ------ 0")
t2 = leftshift(temp)
42
#print("left shift ",temp," == ",t2)
t2 = (t2)^temp
#print("t2 xor with temp == ",t2)
return t2
else:
#print("Entered value ========= main pass")
pass
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def mixcolumns(state):
#print("////////////////////////////////////////MIX
COULUMNS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
mat = [[2,3,1,1],[1,2,3,1],[1,1,2,3],[3,1,1,2]]
temp = [[0 for i in range(4)] for i in range(4)]
temp1 = [[0 for i in range(4)] for i in range(4)]
output = [[0 for i in range(4)] for i in range(4)]
count = 0
for i in range(4):
for j in range(4):
temp[j][i] = state[count]
count+=1
#print("multiplication matrix = ",temp)
for i in range(4):
summ = 0
for j in range(4):
for k in range(4):
#print("sum before = ",summ)
43
#print("val[",i,"][",k,"] , val[",k,"][",j,"] == val[",i,"][",k,"]*val[",k,"]
[",j,"]",mat[i][k],int(temp[k][j],16),mat[i][k]*int(temp[k][j],16))
summ = summ^rijndael(mat[i][k],int(temp[k][j],16))
#print("sum after = ",hex(summ))
output[i][j] = hex(summ)
temp1[i][j] = summ
summ = 0
#print("---------------------------after matrix multiplication---------------------------")
#for i in range(4):
#print(output[i])
#print(temp1[i])
count = 0
for i in range(4):
for j in range(4):
state[count] = output[j][i]
count+=1
#print(state)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def enc_round(Input,word,state):
state = Input.copy()
for i in range(11):
#print("***************ROUND",i,"**************************ROUND",i,"****
****************************")
if i==0:
44
#print("***************ROUND
0**************************ROUND 0********************************")
add_round_key(word,state,i)
elif(i==10):
#print("***************ROUND
10**************************ROUND 10********************************")
substitute_bytes(state)
shiftrows(state)
add_round_key(word,state,i)
else:
#print("***************ROUND",i,"**************************ROUND",i,"****
****************************")
substitute_bytes(state)
shiftrows(state)
mixcolumns(state)
add_round_key(word,state,i)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def encryption(message,word):
Input = [0 for i in range(16)]
output = [0 for i in range(16)]
state = [0 for i in range(16)]
print("---------------------**************--ENCRYPTION--
*************---------------------------")
for i in range(16):
Input[i] = hex(ord(message[i]))
45
#print("Input array = ",Input)
state = enc_round(Input,word,state)
st = []
text = ""
#print("state matrix Inside Encryption ===== ",state)
for i in state:
#print(type(i),"value of i = ",i)
#print(chr(int(i,16)))
st.append(chr(int(i,16)))
text+=chr(int(i,16))
print("st ============================= ",st)
print("+++++++++++++++ ++++ ++++ +++++++++ FINAL ENCRYPTED
TEXT +++++++++++++++ ++++ ++++ +++++++++ ",text)
#for i in text:
#print(hex(ord(i)))
return text
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def rotword(temp):
#print("------------------------------ENTERED
((ROTWORD))----------------------------------------")
temp[0],temp[1],temp[2],temp[3] = temp[1],temp[2],temp[3],temp[0]
#print("temp = ",temp)
return temp
#----------------------------------------------------------------------------------------------------------
--------------------------
46
#----------------------------------------------------------------------------------------------------------
--------------------------
def subword(t):
#print("------------------------------ENTERED
((SUBWORD))----------------------------------------")
temp = t
for i in range(4):
k = int(temp[i],16)
k = format(k,"08b")
#print("lk,rk = ",k[:4],k[4:])
lk = int(k[:4],2)
rk = int(k[4:],2)
#print("lk,rk = ",int(lk),int(rk))
temp[i] = hex(s_box[int(lk)][int(rk)])
t = temp.copy()
#print("after substitution = ",t)
return t
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def key_gen(k,word):
k = list(k)
key = [0 for i in range(16)]
for i in range(16):
key[i] = hex(ord(k[i]))
#print(key)
temp = 0
for j in range(4):
word[j] = [key[4*j],key[4*j+1],key[4*j+2],key[4*j+3]]
47
#print("word[",j,"] = ",word[j])
for j in range(4,44):
temp = word[j-1].copy()
if j%4==0:
#print("i value = ",j)
#print("value[i//4] = ",j//4)
temp = subword(rotword(temp))
#print("temp = ",temp)
#print("temp[0], rcon =",temp[0],hex(rcon[(i//4)-1]) )
temp[0] = hex(int(temp[0],16)^rcon[(j//4)-1])
#print("temp[0] after = ",temp[0])
#print("word[",j-4,"],,,,temp = ",word[j-4],temp)
word[j] = [hex(int(word[j-4][0],16)^int(temp[0],16)),hex(int(word[j-4]
[1],16)^int(temp[1],16)),hex(int(word[j-4][2],16)^int(temp[2],16)),hex(int(word[j-4]
[3],16)^int(temp[3],16))]
#print("word[",j,"]",word[j])
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
if __name__ == "__main__":
message = input("enter the message:")
k = input("enter the key:")
count = 0
word = [0]*44
key_gen(k,word)
print("after key_gen")
for i in range(44):
print("word[",i,"]",word[i])
print("message = ",message)
48
ec = ""
ec = encryption(message,word)
print("encrypted text inside main ============ ",ec)
f = open("new.txt","w")
f.write(ec)
f.close()
print("WARNING ========= WARNING ================ WARNING
======= READING FROM FILE ============ WARNING=============")
g = open("new.txt","r")
for i in g.read():
print(hex(ord(i)))
g.close()
5.2.3 Pixel Data Decryption Module
from aes128_dec import *
from aes128_enc import *
import base64
if __name__ == "__main__":
dec_string = ""
f = open("base64.txt","r")
g = open("sample.txt","w")
h = open("sample1.txt","w")
temp = " "
k = input("enter 16byte key = ")
word = [0]*44
key_gen(k,word)
count = 1
lines = f.readlines()
49
for line in lines:
print("entered == ",count)
temp = line.strip()#"«ð/\x9bÆA¨~\x9f\x94ÉøéKÍÈ" #f.read(16)
#if(temp=='' or len(temp)==0):
#break
print("1 ---->> temp ,type , len(temp) == ",temp,type(temp),len(temp))
temp = temp.encode("utf-8")
temp = temp[2:-1]
print("2 ---->> temp ,type , len(temp) == ",temp,type(temp),len(temp))
temp = base64.b64decode(temp)
print("3 ---->> temp ,type , len(temp) == ",temp,type(temp),len(temp))
temp = temp.decode("utf-8")
#g.write(temp)
#print("after decode utf-8 == ",str(temp),type(temp),len(temp))
#print("happy ")
k = decrypt(str(temp),word)
dec_string = dec_string+k
k = k+'\n'
print("decrypt == ",k)
g.write(k)
#break
count+=1
#content = f.read()
#print("encrypted content = ",content)
h.write(dec_string)
f.close()
h.close()
g.close()
aes128_dec.py:
50
inv_s_box = (
(0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81,
0xF3, 0xD7, 0xFB),
(0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4,
0xDE, 0xE9, 0xCB),
(0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42,
0xFA, 0xC3, 0x4E),
(0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D,
0x8B, 0xD1, 0x25),
(0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D,
0x65, 0xB6, 0x92),
(0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7,
0x8D, 0x9D, 0x84),
(0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8,
0xB3, 0x45, 0x06),
(0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01,
0x13, 0x8A, 0x6B),
(0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0,
0xB4, 0xE6, 0x73),
(0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C,
0x75, 0xDF, 0x6E),
(0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA,
0x18, 0xBE, 0x1B),
(0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78,
0xCD, 0x5A, 0xF4),
(0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27,
0x80, 0xEC, 0x5F),
(0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93,
0xC9, 0x9C, 0xEF),
51
(0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C,
0x83, 0x53, 0x99, 0x61),
(0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55,
0x21, 0x0C, 0x7D)
)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def add_round_key(word,state,round_no):
#print("//////////////////////////////////////////ADD ROUND
KEY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
ll = 40-(round_no*4)
ul = 43-(round_no*4)
index = 0
for j in range(ll,ul+1):
#print("state[",index,"] , word[",j,"][",0,"] , index =====
",state[index],word[j][0],index)
state[index] = hex(int(state[index],16)^int(word[j][0],16))
#print("sstate[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
#print("state[",index,"] , word[",j,"][",0,"] , index =====
",state[index],word[j][1],index)
state[index] = hex(int(state[index],16)^int(word[j][1],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
#print("state[",index,"] , word[",j,"][",0,"] , index =====
",state[index],word[j][2],index)
state[index] = hex(int(state[index],16)^int(word[j][2],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
52
index+=1
#print("state[",index,"] , word[",j,"][",0,"] , index =====
",state[index],word[j][3],index)
state[index] = hex(int(state[index],16)^int(word[j][3],16))
#print("state[",index,"]",state[index],int(state[index],16)^int(word[j][0],16))
index+=1
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def inv_shiftrows(state):
#print("//////////////////////////////////////////INVERSE
SHIFTROWS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
temp = [[0 for i in range(4)]for i in range(4)]
count=0
for i in range(4):
for j in range(4):
temp[j][i] = state[count]
count+=1
#print("-------------befor inv_shiftrows------------------")
#for i in range(4):
#print(temp[i])
temp[1] = [temp[1][3],temp[1][0],temp[1][1],temp[1][2]]
temp[2] = [temp[2][2],temp[2][3],temp[2][0],temp[2][1]]
temp[3] = [temp[3][1],temp[3][2],temp[3][3],temp[3][0]]
#print("-------------after inv_shiftrows------------------")
#for i in range(4):
#print(temp[i])
count = 0
53
for i in range(4):
for j in range(4):
state[count] = temp[j][i]
count+=1
#print("----------------state after inv_shifrows-----------------")
#print(state)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def inv_substitute_bytes(state):
#print("//////////////////////////////////////////INVERSE SUBSTITUTE
BYTES\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
#print("state_before_inv_subbytes = ",state)
for i in range(16):
k = int(state[i],16)
bin_val = format(k,"08b")
l_index = int(bin_val[:4],2)
r_index = int(bin_val[4:],2)
state[i] = hex(inv_s_box[l_index][r_index])
#print("state_after_inv_subbytes = ",state)
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def leftshift(temp):
t = format(temp,"08b")
t = t[1:]+'0'
return int(t,2)
54
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def mul_2(value):
#print("---------- entered mul_2 function ----------")
t1 = format(value,"08b")
if(t1[0]=='1'):
#print("enterd condition 02 ------ 1")
t2 = leftshift(value)
#print("left shift ",value," == ",t2)
t2 = t2 ^ int("0x1b",16)
#print("xor with 1b == ",t2)
return t2
elif(t1[0]=='0'):
#print("enterd condition 02 ------ 0")
t2 = leftshift(value)
#print("left shift ",value," == ",t2)
return t2
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def rijndael(mat,temp):
if(mat == 9):
#print("Entered value ========= 09")
val = mul_2(mul_2(mul_2(temp)))^temp
return val
elif(mat == 11):
#print("Entered value ========= 0B")
55
val = mul_2(mul_2(mul_2(temp))^temp)^temp
return val
elif(mat == 13):
#print("Entered value ========= 0D")
val = mul_2(mul_2(mul_2(temp)^temp))^temp
return val
elif(mat == 14):
#print("Entered value ========== 0E")
val = mul_2(mul_2(mul_2(temp)^temp)^temp)
return val
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def inv_mixcolumns(state):
#print("////////////////////////////////////////INVERSE MIX
COULUMNS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\")
mat = [[0x0e,0x0b,0x0d,0x09],
[0x09,0x0e,0x0b,0x0d],
[0x0d,0x09,0x0e,0x0b],
[0x0b,0x0d,0x09,0x0e]]
temp = [[0 for i in range(4)] for i in range(4)]
temp1 = [[0 for i in range(4)] for i in range(4)]
output = [[0 for i in range(4)] for i in range(4)]
count = 0
for i in range(4):
for j in range(4):
temp[j][i] = state[count]
count+=1
#print("multiplication matrix = ",temp)
56
for i in range(4):
summ = 0
for j in range(4):
for k in range(4):
#print("sum before = ",summ)
#print("val[",i,"][",k,"] , val[",k,"][",j,"] == val[",i,"][",k,"]*val[",k,"]
[",j,"]",mat[i][k],int(temp[k][j],16),mat[i][k]*int(temp[k][j],16))
summ = summ^rijndael(mat[i][k],int(temp[k][j],16))
#print("sum after = ",hex(summ))
output[i][j] = hex(summ)
temp1[i][j] = summ
summ = 0
#print("---------------------------after matrix multiplication---------------------------")
#for i in range(4):
#print(output[i])
#print(temp1[i])
count = 0
for i in range(4):
for j in range(4):
state[count] = output[j][i]
count+=1
#print(state)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def dec_round(Input,word,state):
state = Input.copy()
for i in range(11):
57
#print("***************ROUND",i,"**************************ROUND",i,"****
****************************")
if i==0:
#print("***************ROUND
0**************************ROUND 0********************************")
add_round_key(word,state,i)
elif(i==10):
#print("***************ROUND
10**************************ROUND 10********************************")
inv_shiftrows(state)
inv_substitute_bytes(state)
add_round_key(word,state,i)
else:
#print("***************ROUND",i,"**************************ROUND",i,"****
****************************")
inv_shiftrows(state)
inv_substitute_bytes(state)
add_round_key(word,state,i)
inv_mixcolumns(state)
return state
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
def decrypt(enc_message,word):
Input = [0 for i in range(16)]
output = [0 for i in range(16)]
state = [0 for i in range(16)]
58
print("---------------------**************--DECRYPTION--
*************---------------------------")
for i in range(16):
Input[i] = hex(ord(enc_message[i]))
#print("Input array = ",Input)
state = dec_round(Input,word,state)
#print(state)
txt = ""
for i in state:
txt+=chr(int(i,16))
return txt
#----------------------------------------------------------------------------------------------------------
--------------------------
#----------------------------------------------------------------------------------------------------------
--------------------------
if __name__ == "__main__":
f = open("new.txt","r")
enc = f.read()
for i in enc:
print(type(i))
print(i)
msg = decrypt()
5.2.4 Encrypted Pixel Data Hiding/Extracting Module
import base64
59
def main():
f = open("base64.txt","rb").read()
print("after read === ",f,type(f))
g = open("s1.txt","wb")
a = base64.b64encode(f)
print("===========================================================
======================")
g.write(a)
print(len(a))
print(a)
a = str(a)
a = a[2:-1]
unique = list(dict.fromkeys(a))
print(unique)
print("===========================================================
======================")
if __name__=="__main__":
main()
lsb.py:
from PIL import Image
import base64
from stegano import lsb
#==============================================================
===============================================================
======================================
60
def conv_number(car):
if(car=="A"):
return 0
if(car=="B"):
return 1
if(car=="C"):
return 2
if(car=="D"):
return 3
if(car=="E"):
return 4
if(car=="F"):
return 5
if(car=="G"):
return 6
if(car=="H"):
return 7
if(car=="I"):
return 8
if(car=="J"):
return 9
if(car=="K"):
return 10
if(car=="L"):
return 11
if(car=="M"):
return 12
if(car=="N"):
return 13
if(car=="O"):
61
return 14
if(car=="P"):
return 15
if(car=="Q"):
return 16
if(car=="R"):
return 17
if(car=="S"):
return 18
if(car=="T"):
return 19
if(car=="U"):
return 20
if(car=="V"):
return 21
if(car=="W"):
return 22
if(car=="X"):
return 23
if(car=="Y"):
return 24
if(car=="Z"):
return 25
if(car=="a"):
return 26
if(car=="b"):
return 27
if(car=="c"):
return 28
if(car=="d"):
62
return 29
if(car=="e"):
return 30
if(car=="f"):
return 31
if(car=="g"):
return 32
if(car=="h"):
return 33
if(car=="i"):
return 34
if(car=="j"):
return 35
if(car=="k"):
return 36
if(car=="l"):
return 37
if(car=="m"):
return 38
if(car=="n"):
return 39
if(car=="o"):
return 40
if(car=="p"):
return 41
if(car=="q"):
return 42
if(car=="r"):
return 43
if(car=="s"):
63
return 44
if(car=="t"):
return 45
if(car=="u"):
return 46
if(car=="v"):
return 47
if(car=="w"):
return 48
if(car=="x"):
return 49
if(car=="y"):
return 50
if(car=="z"):
return 51
if(car=="0"):
return 52
if(car=="1"):
return 53
if(car=="2"):
return 54
if(car=="3"):
return 55
if(car=="4"):
return 56
if(car=="5"):
return 57
if(car=="6"):
return 58
if(car=="7"):
64
return 59
if(car=="8"):
return 60
if(car=="9"):
return 61
if(car=="+"):
return 62
if(car=="/"):
return 63
if(car=="="):
return 64
if(car=="'"):
return 65
#==============================================================
===============================================================
======================================
def conv_character(num):
if(num==0):
return 'A'
if(num==1):
return 'B'
if(num==2):
return 'C'
if(num==3):
return 'D'
if(num==4):
return 'E'
if(num==5):
return 'F'
65
if(num==6):
return 'G'
if(num==7):
return 'H'
if(num==8):
return 'I'
if(num==9):
return 'J'
if(num==10):
return 'K'
if(num==11):
return 'L'
if(num==12):
return 'M'
if(num==13):
return 'N'
if(num==14):
return 'O'
if(num==15):
return 'P'
if(num==16):
return 'Q'
if(num==17):
return 'R'
if(num==18):
return 'S'
if(num==19):
return 'T'
if(num==20):
return 'U'
66
if(num==21):
return 'V'
if(num==22):
return 'W'
if(num==23):
return 'X'
if(num==24):
return 'Y'
if(num==25):
return 'Z'
if(num==26):
return 'a'
if(num==27):
return 'b'
if(num==28):
return 'c'
if(num==29):
return 'd'
if(num==30):
return 'e'
if(num==31):
return 'f'
if(num==32):
return 'g'
if(num==33):
return 'h'
if(num==34):
return 'i'
if(num==35):
return 'j'
67
if(num==36):
return 'k'
if(num==37):
return 'l'
if(num==38):
return 'm'
if(num==39):
return 'n'
if(num==40):
return 'o'
if(num==41):
return 'p'
if(num==42):
return 'q'
if(num==43):
return 'r'
if(num==44):
return 's'
if(num==45):
return 't'
if(num==46):
return 'u'
if(num==47):
return 'v'
if(num==48):
return 'w'
if(num==49):
return 'x'
if(num==50):
return 'y'
68
if(num==51):
return 'z'
if(num==52):
return '0'
if(num==53):
return '1'
if(num==54):
return '2'
if(num==55):
return '3'
if(num==56):
return '4'
if(num==57):
return '5'
if(num==58):
return '6'
if(num==59):
return '7'
if(num==60):
return '8'
if(num==61):
return '9'
if(num==62):
return '+'
if(num==63):
return '/'
if(num==64):
return '='
if(num==65):
return "'"
69
#==============================================================
===============================================================
======================================
def genData(data):
newd = []
temp = None
for i in data:
temp = conv_number(i)
print("temp and type == ",temp,type(i))
newd.append(format(temp, '08b'))
return newd
#==============================================================
===============================================================
======================================
def modPix(pix, data):
datalist = genData(data)
lendata = len(datalist)
imdata = iter(pix)
for i in range(lendata):
pix = [value for value in imdata.__next__()[:3] +
imdata.__next__()[:3] +
imdata.__next__()[:3]]
#print("datalist == ",datalist[i])
#print("pix value == ",pix)
for j in range(0, 8):
if (datalist[i][j] == '0') and (pix[j] % 2 != 0):
if (pix[j] % 2 != 0):
pix[j] -= 1
70
elif (datalist[i][j] == '1') and (pix[j] % 2 == 0):
pix[j] -= 1
#print("pix value after == ",pix)
if (i == lendata - 1):
print("i value inside if == ",i)
if (pix[-1] % 2 == 0):
pix[-1] -= 1
else:
if (pix[-1] % 2 != 0):
pix[-1] -= 1
pix = tuple(pix)
#print("pix value before sending == ",pix)
yield pix[0:3]
yield pix[3:6]
yield pix[6:9]
#==============================================================
===============================================================
======================================
def encode_enc(newimg, data):
w = newimg.size[0]
(x, y) = (0, 0)
for pixel in modPix(newimg.getdata(), data):
#print("inside encode enc == ",pixel)
#print("<< x,y >>",x,y)
newimg.putpixel((x, y), pixel)
if (x == w - 1):
x = 0
y += 1
else:
71
x += 1
#==============================================================
===============================================================
======================================
def encode():
img = input("Enter image name(with any extension) : ")
image = Image.open(img, 'r')
#file = open("sample1.txt", "r")
op = open("s1.txt","rb").read()
data = str(op)
secret = lsb.hide("lion.png",data)
secret.save("kunti.png")
''''#print(op)
#input("enter data to encode:")
print("type and length of data == ",type(data),len(data))
#file.close()
print(len(data))
if (len(data) == 0):
raise ValueError('Data is empty')
newimg = image.copy()
encode_enc(newimg, data)
new_img_name = input("Enter the name of new image(PNG extension) : ")
newimg.save(new_img_name, str(new_img_name.split(".")[1].upper()))'''
#==============================================================
===============================================================
======================================
def decode():
clear_message = lsb.reveal("kunti.png")
print(clear_message)
'''count = 1
72
img = input("Enter image name(with extension PNG) : ")
image = Image.open(img, 'r')
data = ''
imgdata = iter(image.getdata())
while (True):
pixels = [value for value in imgdata.__next__()[:3] +
imgdata.__next__()[:3] +
imgdata.__next__()[:3]]
binstr = ''
for i in pixels[:8]:
if (i % 2 == 0):
binstr += '0'
else:
binstr += '1'
#data += conv_character(int(binstr, 2))
if (pixels[-1] % 2 != 0):
k = data
#print(k)
print(len(data))
print(len(k))
print("type of k before == ",type(k))
#print(k)
k = k[2:-1]
#k = k+"==============="
print("length of k after k[2:-1],len of var == ",len(k),len(var))
k = k.encode('utf-16')
for i,j in var,k:
if i!=j:
print("false == ",count)
break
73
count+=1
print("length after k.encode('utf-8') == ",len(k))
print(k)
print("type of k after == ",type(k))
file = open("s10.txt", "wb")
file.write(k)
file.close()
#op = open("s10.txt","rb").read()
#print("file type of op == ",type(op))
txt = base64.b64decode(k)
with open("final.txt","wb") as file:
file.write(txt)
return data'''
print("type of message == ",type(clear_message))
clear_message = clear_message[2:-1]
clear_message = clear_message.encode("utf-8")
dec = base64.b64decode(clear_message)
with open("final.txt","wb") as file:
file.write(dec)
return None
#==============================================================
===============================================================
======================================
def main():
a = int(input("1. Encode\n 2. Decode\n"))
if (a == 1):
encode()
elif (a == 2):
word = decode()
74
#lengthofword = len(word)
#print("Decoded word- " + word)
print("lengh of the decoded word == ",lengthofword)
else:
raise Exception("Enter correct input")
#==============================================================
===============================================================
======================================
if __name__ == '__main__':
main()
5.2.5 Pixel Data to Image Module
from PIL import Image
if __name__ == "__main__":
j = 0
print("===========================================================
======")
f= open("sample1.txt","r")
#temp = f.read()
#print("string of pixels == ",type(temp),temp)
newd = []
temp1 = []
strr = ''
count = 1
t1 = " "
while(t1!='' or len(t1)!=0):
t1 = f.read(3)
75
if(len(t1)==0):
break
t2 = int(f.read(3))
t3 = int(f.read(3))
t1 = int(t1)
a = ()
a = a+(t1,t2,t3)
print("---> ",a,t1,t2,t3,count,type(t1))
newd.append(a)
count+=1
'''for i in temp:
print("data == ",f.read(9),i,count)
count+=1
if(j!=3):
strr+=i
j+=1
print("entered 1")
if j==3:
temp1.append(int(strr))
j=0
print("entered 2")
if len(temp1)==3:
print("count == ",count)
newd.append(tuple(temp1))
temp1 = []
count+=1
print("entered 3")'''
print(newd)
f.close()
76
print("===========================================================
======")
new = Image.new("RGB",(128,128))
new.putdata(newd)
new.save("receiver.jpeg")
77
5.4 Experimental Analysis/Testing
Let the secret image pixel dimensions be L X B
The total number of pixels in secret image would be = L*B
We know that, each pixel contains 3 sub pixels,
hence total number of sub pixels = 3*(L*B)
Each sub pixel varies from 000 to 255, hence = 3*3*(L*B)
Now to hide the secret image, the minimum pixels requirement of the cover image is,
sqrt(9*L*B) which is 3*sqrt(L*B).
Image Size Pixels Time
sender.jpeg 2.507kB 128*128 42 seconds
256.png 6.051kB 256*256 150 seconds
82
Secret image
Fig.5.4.1 secret image sample
Cover image
Fig.5.4.2 Original cover image Fig.5.4.3 Hidden cover image
83
Histogram results
Fig.5.4.4 Original Fig.5.4.5 Hidden
Fig.5.4.6 Original Fig.5.4.7 Hidden
Fig.5.4.8 Original Fig.5.4.9 Hidden
84
6. CONCLUSION AND FUTURE WORK
6.1 Conclusion
In this project, we've taken the matter of sharing the pictures within the public channels.
It is known that the layman to technology uses the general public channels aren't secured
to the extent to satisfy the confidentiality and integrity to the user. Many steganography
methods are been used to hide the secret images inside the cover images that are been
transmitted into the insecure channels. However, using the steganographic methods alone
may lead to extraction of the secret images with the known method of hiding. Hence, in
this project we have used the combined method of hiding the encrypted image into the
cover image. Therefore, even in the scenario where the hacker can extract the hidden
data, fails to decrypt the data to form the original secret image. By consolidating the two
methods of cryptography and steganography, the safety of image transfer through the
insecure channels is achieved.
6.2 Future work
In the future work, we want to use a modified version of AES with a change in the rounds
of AddRound step. This increases the possible permutations, which would result in a
better security. Apart from image security, in the future work, providing security to the
different types of files like mp3, mp4, .exe, etc.
85
REFERENCES
[1] J. K. Saini and H. K. Verma, “A hybrid approach for image security by combining
encryption and steganography,” in Image Information Processing (ICIIP), 2013 IEEE
Second International Conference on IEEE, 2013, pp. 607–611.
[2] P. Kumar and V. K. Sharma, “Information security based on steganography &
cryptography techniques: A review,” International Journal, vol. 4, no. 10, 2014.
[3] H. Sharma, K. K. Sharma, and S. Chauhan, “Steganography techniques using
cryptography-a review paper,” 2014.
[4] A. Dhamija and V. Dhaka, “A novel cryptographic and steganographic approach for
secure cloud data migration,” in Green Computing and Internet of Things (ICGCIoT),
2015 International Conference on. IEEE, 2015, pp. 346–351.
[5] P. Vijayakumar, V. Vijayalakshmi, and G. Zayaraz, “An improved level of security
for dna steganography using hyperelliptic curve cryptography,” Wireless Personal
Communications, pp. 1–22, 2016.
[6] S. S. Patil and S. Goud, “Enhanced multi level secret data hiding,” 2016.
[7] B. Karthikeyan, A. C. Kosaraju, and S. Gupta, “Enhanced security in steganography
using encryption and quick response code,” in Wireless Communications, Signal
Processing and Networking (WiSPNET), International Conference on. IEEE, 2016, pp.
2308–2312.
[8] B. Pillai, M. Mounika, P. J. Rao, and P. Sriram, “Image steganography method using
k-means clustering and encryption techniques,” in Advances in Computing,
86
Communications and Informatics (ICACCI), 2016 International Conference on. IEEE,
2016, pp. 1206–1211.
[9] F. Joseph and A. P. S. Sivakumar, “Advanced security enhancement of data before
distribution,” 2015.
[10] B. Padmavathi and S. R. Kumari, “A survey on performance analysis of des, aes and
rsa algorithm along with lsb substitution,” IJSR, India, 2013.
[11] R. Das and T. Tuithung, “A novel steganography method for image based on
huffman encoding,” in Emerging Trends and Applications in Computer Science
(NCETACS), 2012 3rd National Conference on. IEEE, 2012, pp. 14–18.
[12] K. Muhammad, J. Ahmad, M. Sajjad, and M. Zubair, “Secure image steganography
using cryptography and image transposition,” arXiv preprintarXiv:1510.04413, 2015.
[13] S. E. Thomas, S. T. Philip, S. Nazar, A. Mathew, and N. Joseph, “Advanced
cryptographic steganography using multimedia files,” in International Conferenc on
Electrical Engineering and Computer Science (ICEECS-2012), 2012.
[14] A. Gambhir and A. R. Mishra, “A new data hiding technique with multilayer
security system.” 2015.
[15] M. H. Sharma, M. MithleshArya, and M. D. Goyal, “Secure image hiding algorithm
using cryptography and steganography,” IOSR Journal of Computer Engineering (IOSR-
JCE) e-ISSN, pp. 2278–0661, 2013.
87
A Hybrid Approach for Image Security by Combining Encryption and Steganography
Jaspal Kaur Saini Department of Computer Science and Engineering
National Institute of Technology Jalandhar, Punjab, India [email protected]
Harsh K Verma Department of Computer Science and Engineering
National Institute of Technology Jalandhar, Punjab, India
Abstract— Multimedia data is more used on internet so it is desired to secure the data before transmitting. Various algorithms have been researched and proposed in this regards. This paper presents the hybrid approach for image security that combines both encryption and steganography. First the image is encrypted using proposed new version of AES algorithm, which is then hided into cover image using the steganography concept. Experimental results and analysis is shown. This hybrid approach provides greater security against attacks.
Keywords— Information Security, Cryptography, Steganography, Advance Encryption Standard (AES), Modified Advance Encryption Standard (MAES), Image Encryption, Image Steganography, Statistical Analysis.
I. INTRODUCTION To ensure the confidentiality, integrity and availability of
information, it is desired to secure the information. One major branch of information security is cryptography, the art and science of securing the data [1]. Cryptography allows the original data to be converted into cipher data that can be sent over the unsecure channel. Fig. 1. illustrates the concept of cryptography. Encryption is the process of converting the original data into cipher data so that only intended recipient can decipher the data by applying decryption [2].
Sender Receiver
Fig. 1. Cryptography.
Steganography is the branch of information security that enables the information hiding. It is the art and science of hiding the data within a cover in order to avoid disruption, modification and disclosure etc. Steganography differs from cryptography in the sense that it keeps the existence of information secret while cryptography keeps contents of information secret. Fig. 2. describes the steganography process. Embedding is the process of hiding a secret message within a cover. A great deal of attention is required so that secret message goes unnoticed if third party intercepts the message.
Extracting is the inverse of embedding process where secret message is revealed at the end.
Sender Receiver
Fig. 2. Steganography.
This paper proposes hybrid approach for image security. First, the image encryption technique based on AES is used to convert the original image into cipher image. AES is symmetric cipher with block size 128 bits, and key size of 128, 192, or 256 bits. After applying the cryptography concept, we proposed image steganography technique to hide the encrypted image into a cover image. This modification provides greater security against attacks.
The paper is organized into following sections: Section 2 presents the image encryption scheme. Section 3 describes the image steganography technique used to hide the information. Section 4 explains the proposed hybrid approach for image security. Section 5 shows the experimental results. Section 6 evaluates the algorithm performance. Section 7 concludes the paper.
II. IMAGE ENCRYPTION USING AES Various techniques have been proposed using AES for
image encryption [7, 12].The Advanced Encryption Standard is the replacement of DES endorsed by the National Institute of Standards and Technology (NIST) in Federal Information Processing Standard (FIPS) 197 [4][6]. It’s the characteristics of AES: ease of implementation, cost effective and security that attracts the researcher to use the AES encryption and its enhanced version for image security.AES is AES is non feistel block cipher that encrypts and decrypts the block size of 128 bits with variable number of rounds 10, 12 or 14 that depends upon the key size which can be 128,192 or 256 bits [3]. However, the round keys which are generated by key expansion algorithm are always 128 bit. AES uses four types of transformations: add round key, sub byte, shift row and mix column transformation in order to generate the cipher text [5].
Decryption Encryption
Cipher-Key
Extracting Embedding
Stego-Key
Proceedings of the 2013 IEEE Second International Conference on Image Information Processing (ICIIP-2013)
978-1-4673-6101-9/13/$31.00 ©2013 IEEE 607
We proposed a modification in AES as Modified AES (MAES) which presents a new shift row transformation that enhances the security of AES. MAES is byte oriented. The 128 bit plaintext is considered as sixteen 8 bit bytes. To be able to perform some mathematical transformations on bytes MAES defined the concept of state. A state is 4*4 matrix in which each entry is byte. The transformations used in MAES are:
1. Add Round Key: Add Round Key performs the xor between state and the round key.
2. Sub Bytes: Sub Bytes is a substitution of each byte in the state from S box.
3. New Shift Row: The Shift Rows step is performed on the rows of the state. It cyclically shifts the bytes of each row depending upon the first element of state. If the value in first row and first column of state matrix is even then first row remains unchanged; each bytes in second, third and fourth are cyclically shifted left over different numbers.
4. Mix Column: In the MixColumns step, each column of the state is multiplied with a fixed polynomial c(x).
Fig. 3. illustrates flowchart of proposed MAES encryption scheme.
Fig. 3. MAES Encryption.
Table I shows the encryption and decryption algorithm used to encrypt and decrypt images.
TABLE I. MAES ENCRYPTION AND DECRYPTION
MAES_ENCRYPTION MAES_DECRYPTION
Step 1: Read the input image. Step 2: Convert the image into 16*16 blocks. Step 3: for each block repeat the steps 4 to 6. Step 4: [Pre initial Round] 4.1: AddRoundKey (state,
Step 1: Read the cipher image. Step 2: Convert the encrypted image into 16*16 blocks. Step 3: for each block repeat the steps 4 to 6. Step 4: [Pre initial Round] 4.1: AddRoundKey (state,
roundkey) Step 5: for round=1 to Nr-1 [(Nr-1) Rounds] 5.1: SubBytes (state, s_box) 5.2: M_ShiftRows(state) 5.3: MixColumns(state, poly_mat) 5.4: AddRoundKey (state, roundkey) end for Step 6: [Final Round] 6.1: SubByte (state, s_box) 6.2: M_ShiftRows(state) 6.3: AddRoundKey(state, roundkey) Step 7: Combine all encrypted blocks to constitute cipher image.
roundkey) Step 5: for round=1 to Nr-1 [(Nr-1) Rounds] 5.1: InvM_ShiftRows(state) 5.2: InvSubBytes (state, inv_s_box) 5.3: AddRoundKey (state, roundkey) 5.4: InvMixColumns (state, inv_poly_mat) end for Step 6: [Final Round] 6.1: InvM_ShiftRows(state) 6.2: InvSubBytes (state, inv_s_box) 6.3: AddRoundKey (state, roundkey) Step 7: Combine all blocks to reconstruct the plain image.
III. IMAGE STEGANOGRAPHY Image steganography is the branch of steganography that
allows the secret images to be hidden in another cover image. Many image steganography techniques have been proposed to hide the information [13]. We used a very simple approach to hide the secret image in very large image. The data hidden in the image can only be retrieved by the intended recipient who knows the extracting algorithm to decode the stego image. A well developed steganography technique is supposed to have two major properties: more data hiding capacity and unidentified secret data. We proposed the technique that provides more of secret data to be hidden in cover image by providing more data hiding capacity.
Least Significant bit is the image steganography technique which hides the secret data in the least significant bits of the cover image used. For example, for an 8 bit image, the LSB (8th bit of image) is replaced with bit of secret message.
Fig. 4. Image Hiding.
We proposed the scheme that is similar to LSB method. It basically uses 8 pixels from source image to form 8 bit of embedded image. We can minimize the image degradation by
Original image
Encrypted image
MAES Encryption
Secret image
Stego image
Embedding Cover image
Proceedings of the 2013 IEEE Second International Conference on Image Information Processing (ICIIP-2013)
608
choosing the large cover image. Another bethe large cover image is that the more thancan be embedded into the cover image hencdata hiding capacity. Fig. 4. shows the embhide secret image using cover image.
IV. HYBRID APPROACH FOR IMAGE
We proposed the hybrid approach for improvides the good encryption quality anencrypted image in cover image. MAES is uoriginal image to produce cipher image. Thefirst divided into blocks then MAES cipher block to construct cipher image that can be schannel. But if adversary somehow cracksreconstruct the original image from intercepmay lead to chaos. So we proposed a hybsecure communication. We embed the encover image to ensure that no other than comcan judge the communication, hence accouwriting and covered writing. The proposed shown in Fig. 5.
Fig. 5. Hybrid Approach for Image se
V. EXPERIMENTAL RESUL
Proposed algorithms are tested and evaR2009. Performance was measured on IntelCPU T 5750 @ 2.00 GHz 2 GHz 32 bit sys
Encrypted image
Stego image
Embedding
Original image
MAES Encryption
enefit of choosing n one secret image ce providing more bedding process to
E SECURITY mage security that nd then hide the used to encrypt the e original image is is applied to each
sent over unsecure s the algorithm to pted image, then it brid approach for
ncrypted image in mmunicating parties
unting both secret hybrid scheme is
ecurity.
LTS aluated on Matlab (R) CoreTM 2 Duo
stem with 2 GB of
RAM running Windows 7 Profas original images (Plain Imageoriginal image, encrypted imagscale image (flowers.jpg, 1(peppers.jpg, 128 128) respect
(a) Origi
(b) Encrypted Image
Fig. 6. Encryption using
(a) Origi
(b) Encrypted Image
Fig. 7. Encryption usin
After applying the Modigrayscale and colored imagesapproach to hide the encrypteexperimental results are showhouse.jpg 301 436 3, as covimages. When the encrypted im33.3018 percent of the cover image used 99.8852 percent of images are shown in Fig. 8.
Cover image
fessional. We use several images e). Fig. 6. and Fig. 7. shows the ge and recovered image for gray 28 128) and colored image tively.
inal Image
(c) Recovered Image
g MAES. (gray-scale image)
inal Image
(c) Recovered Image
ng MAES. (colored image)
ified AES algorithm both to s, we used the steganogrpahy d image into cover image. The
wn in Figure 8. We used the ver image to hide the encrypted mage flower is hided, it used the
image. The peppers encrypted f the cover image. Resulted stego
Proceedings of the 2013 IEEE Second International Conference on Image Information Processing (ICIIP-2013)
609
(a) Cover Image(House.jpg)
(b) Secret Image 1 (Encrypted_Flow
(c) Stego Image 1
(d) Secret Image 2 (Encrypted_Pepp
wers)
pers)
(e) StegFig. 8. Hiding
VI. STATIST
A good encryption scheme attacks. Various security analysencryption schemes [10, 12]. Shand diffusion methods in order
A. Histograms of Encrypted ImWe have calculated and ana
encrypted images as well as oridifferent content as shown in image (Flowers.jpg) (size 12histogram of encrypted image original image. It is clear frocipher image that there is no reencrypted image. Hence does nstatistical attack on proposed im
(a) Original Image
(c) Encrypted Image
Fig. 9. Histo
o Image 2 Encrypted Images.
TICAL ANALYSIS should refuse all kind of known
sis has been performed on image hannon has suggested confusion to discourage the attacks.
mage alyzed the histograms of several iginal images which have totally Fig 7. The histogram of plain
28*128) has large spikes. The is totally different from that of m the histograms of plain and
esemblance between original and not provide any clue to employ
mage encryption procedure.
(b) Histogram
(d) Histogram
ogram Analysis.
Proceedings of the 2013 IEEE Second International Conference on Image Information Processing (ICIIP-2013)
610
B. Correlation of Adjacent Pixels We calculated correlation between adjacent pair of pixels in
three directions: horizontal, vertical and diagonal by using the following formula: , …(i) , …(ii)
Where x and y are gray scale values of two adjacent pixels in the image. Table II shows the correlation coefficient values calculated for various gray scale images of different size.
TABLE II. CORRELATION COEFFICIENT OF ADJACENT PIXELS IN ORIGINAL AND ENCRYPTED IMAGE
C. Image Quality Measures We compared the peak signal to noise ratio of original
image and recovered image. A higher PSNR illustrates that the reconstruction is of high quality.
Mathematically PSNR is calculated using the following equation:
10 log …(iii)
Where MSE (Mean Square Error) is computed as: 1 ∑ …(iv)
Where oi and ri are original image and reconstructed image pixels respectively and m*n is the size of image. We take several sizes of images to test the MAES performance. Table III shows the PSNR and MSE comparison for various gray scale images using original AES and proposed MAES.
TABLE III. COMPARISON OF IMAGE QUALITY MEASURES
VII. CONCLUSION In this paper the hybrid approach for image security has
been presented. The image encryption is done using new version of AES that provides better performance than original AES. The encrypted image is then hided to provide secret communication so that none other than the communicating parties can judge the communication. Simulation results are shown and analyzed to check the effectiveness of the proposed hybrid approach against various attacks.
REFERENCES [1] W. Stallings, "Cryptography and Network Security: Principles and
Practice", Prentice-Hall, New Jersey, 1999. [2] B. Schneier, "Applied Cryptography", John Wiley & Sons Inc., 1999. [3] Behrouz A. Forouzan, "Cryptography and Network Security", Tata
McGraw-Hill Education, 2011. [4] J. Daemen, V. Rijmen, The block cipher Rijndael, Smart Card Research
and Applications (2000) 288–296. [5] “AES”, “wikipedia.org”, [online] Available at:
http://en.wikipedia.org/wiki/Advanced_Encryption_Standard. [6] Federal Information Processing Standards Publication 197(FIPS197),
http://csrc.nist.gov/publications/fips/fips197/fips- 197.pdfS, 2001. [7] An J.J. Amador, R. W.Green “Symmetric-Key Block Cipher for
Imageand Text Cryptography”: International Journal of Imaging Systems and Technology, No. 3, 2005, pp. 178-188.
[8] Seyed Hossein Kamali, Reza Shakerian “A New Modified Version of Advanced Encryption Standard Based Algorithm for Image Encryption”, IEEE Electronics and Information Engineering International Conference (ICEIE 2010). 1-3 Aug. 2010, V1-141 - V1-145.
[9] Shannon CE., "Communication theory of secrecy system," Bell SystTech J 1949; 28: 656-715.
[10] Ratinder Kaur, V. K. Banga “Image Security using Encryption based Algorithm”: International Conference on Trends in Electrical, Electronics and Power Engineering (ICTEEP'2012) July 15-16, 2012 Singapore.
[11] Abdelfatah A. Yahya and Ayman M. Abdalla“A Shuffle Image-Encryption Algorithm”Department of Computer Science, Al-Zaytoonah University of Jordan, Journal of Computer Science 4 (12): 999- 1002, 2008.
[12] M. Zeghid, M. Machhout, L. Khriji, A. Baganne, and R. Tourki “A Modified AES Based Algorithm for Image Encryption”: Proceeding of the World Academy of Science, Engineering and Technololgy, May, WASET Organization, USA,2007.
[13] Hongmei Tang, Gaochan Jin, Cuixia Wu, Peijiao Song, “A New Image Encryption and Steganography Scheme”, IEEE International Conference on Computer and Communications Security,2009, pp:60-63.
Image Size
Direction
Plain Image
Cipher Image
128*128
Horizontal 0.9034 0.00788
Vertical 0.9403 -0.0011
Diagonal 0.8953 -0.0016
256*256
Horizontal 0.9667 -0.00394
Vertical 0.9458 -0.00388
Diagonal 0.9821 -0.00474
512*512
Horizontal 0.9775 -0.03986
Vertical 0.9845 -0.02198
Diagonal 0.9634 -0.0672
Image Size Parameter AES MAES
Flowers.jpg (128 128)
MSE 0.1167 0.1165
PSNR 59.1570 59.1601
Flowers.jpg (256 256)
MSE 0.1290 0.1289
PSNR 59.9771 59.9814
Flowers.jpg (512 512)
MSE 0.1283 0.1282
PSNR 59.4678 59.4681
Proceedings of the 2013 IEEE Second International Conference on Image Information Processing (ICIIP-2013)
611
A HYBRID APPROACH FOR IMAGE SECURITY BY COMBININGENCRYPTION AND STEGANOGRAPHY
1G. Gayathri, 2CH. Sampath, 3A. Aditya, 4P. Sunil Kumar, 5 A. Akhilesh1Assistant Professor, 2,3,4,5Student
1Department of Computer Science & Engineering,1Anil Neerukonda Institute Of Technology And Sciences, Visakhapatnam, India
ABSTRACT
Cyber crime has become a dangerous threat to all the technical users and layman. Due to lack of skill on using the securedmeans in the data communication, many users as well as organizations are suffering. As we know that India is moving astep ahead in technical aspects, which is enhancing and improving the concept “Digital India”, but we must intensify theconcept to “Secure Digital India” where we can see no data breaches, no malicious attacks and no cyber terrorism. Securityin transmission through the public channels, storage of digital images has its importance in today's image communicationsand confidential video conferencing. Because of expanding use in sharing the images in the daily social life, it is essential toprotect the confidential image data from unauthorized access. Advanced Encryption Standard (AES), a block cipher basedalgorithm is a well famous methodology making several advantages in data encryption. We are doing a hybrid approach forimage security that combines both encryption of the image data and hiding the encrypted data into another image throughsteganography. The research helps layman to share the images into the public channels without getting compromised.
Keywords – Cryptography, Steganography, Encryption, Decryption, AES, LSB, Hiding-Extracting, Cyber security,Image security, Cyber threats.
1. INTRODUCTION
Cyber Security is the body of technologies, whose processes and practices are drafted to protect networks. Apart fromdetecting the already existing threat, it also uses the intrusion prevention methods, in order to avert the upcoming threats.In order to avert threat, virus or any unauthorized access into a network or a computer, we need to safeguard the networkwith a firewall and awareness of hacking. It is important to avert security breach which can cause diminution for anorganization. Potential threats like loss, modification, unauthorized access, data leak must be prevented.
1.1 Cryptography
To verify that the confidentiality, integrity and availability of data , it's vital to secure the knowledge. One pivotal branch ofinformation security is cryptography, the science of securing the data. Cryptography permits the original data to beconverted into cipher data that can be sent over the unsecure channel. Fig.1. shows the representational diagram of the stepsfollowed by sender and receiver using cryptography. Encryption is the procedure of transforming the native data intocryptographic data so that only intended recipient can decipher the data by applying decryption.
Fig. 1 Cryptography
1.1.1 Symmetric / Secret Key Cryptography
The strategy of Secret key (same to sender and receiver) encryption can also be known as the symmetric-key, shared key,single-key, and eventually private-key encryption. The technique of private key uses for all side's encryption and decryptionsecret data. The first information or plaintext is encrypted with a key by the sender side also, an equivalent key's employedby the receiver to decrypt the encrypted data to get the plaintext. The key will be known only by the people who arelegitimize to the modules of encryption/decryption. However, the technique pledges the good security for transmission butthere is a difficulty with the distribution of the key. if one nab or explore the key he can get whole data without anydifficulty. A case of Symmetric Key cryptography approach is DES Algorithm.
1.1.2 Asymmetric / Public Key Cryptography
We can call this system as the asymmetric cryptosystem or public key cryptosystem, this uses two keys which aremathematically associated, use separately for encrypting and decrypting the knowledge. During this technique, once we usethe private key, there are not any possibilities to get the info or just discover the opposite key, all keys are needed for thetechnique to run. The key used for encryption is stored public, ergo it’s called public key, and therefore the decryption key'sstored secret and called private key. An example of Asymmetric-Key Algorithms is RSA.
1.2 Steganography
Steganography is the branch of information security that enables the information hiding. It is the art and science of hidingthe data within a cover in order to avoid disruption, modification and disclosure etc. Steganography differs fromcryptography in the sense that it keeps the existence of information secret while cryptography keeps contents of informationsecret. Embedding is the process of hiding a secret message within a cover. A great deal of attention is required so thatsecret message goes unnoticed if third party intercepts the message. Extracting is the inverse of embedding process wheresecret message is revealed at the end.
2. LITERATURE REVIEW
2.1 Related Work
In [4], proposed an encrypting technique by combining cryptography and steganography techniques to cover the info . Incryptography process, they proposed an efficient technique for encoding using one’s complement method, which we calledas SCMACS. It used a symmetric key method where both sender and receiver share an equivalent key for encryption anddecryption. In steganography part, we used the LSB method that's used and mostly preferred.
In [5], authors proposed a highly secured steganography technique by combining DNA sequence with Hyperelliptic CurveCryptography. This approach executes the benefits of both techniques to afford a high level of security communication.Also, it uses the advantages of both DNA cryptography and Steganography. This algorithm tries to cover a secret image inanother cover image by convert them into DNA sequence using the nucleotide to the binary transformation table. On thesender side, the embedding method includes three steps. First, they convert the values of a pixel of both the duvet image andsecret image to their respective DNA triplet value utilizing characters to the DNA triplet conversion. Secondly, they convertthe triplet values to binary values format. within the end , apply the XOR logic between binary values of both secret imageand canopy image to get a replacement image which called stego image.
In [6], authors presented a replacement technique called multi-level secret data hiding which integrates two differentmethods of encryption namely visual cryptography and steganography. After that visual cryptography is performed thatproduces the shares which form the first level of security then steganography during which thy used the LSB method to hidethe shares in several media like image, audio, and video.
The paper at [7] presented a way supported combining both the strongencrypting algorithm and steganographic technique toform the communication of tip safe, secure and very hard to decode. An encryption technique is used for encrypting a secretmessage before encoding it into a QR code. UTF-8 format is converted into base64 format to form it compatible for furtherprocessing. The encoded image is scrambled to realize another security level. The scrambled QR code is finally embeddedduring a suitable cover image, which is then transferred securely to deliver the key information. They utilized a leastsignificant bit method to accomplish the digital image steganography. At the receiver’s side, the key data is retrievedthrough the decoding process. Thus, a four-level security has been rendered for them a secret message to be transferred.
In [8] authors presented a picture steganography method. At first, they used the DES algorithm to encrypt the text message.They used a 16 round and with block size 64-bit. then the K-Means Clustering of The Pixels method which clusters theimage into numerous segments and embedded data in every segment. There are many clustering algorithms use for imagesegmentation. Segmentation includes an enormous set of data within the sort of pixels, where every pixel additional hasthree components namely red, green and blue(RGB). After the formation of clusters, the encrypted text is separated into Knumber of segments. These segments are to be hidden in each cluster. They used the LSB (Least Significant Bit) method forthis purpose.
In [9], authors presented a way to increase the embedding capacity and to enhance the standard of stego image. TheAdaptive Pixel Value Differencing which is an improved sort of Pixel Value Differencing was utilized because theSteganographic system although AES was utilized because the Cryptographic system. during this method, they used apicture as a canopy to cover the key data inside. This cover should be a grayscale image. therefore, pixel size must be256*256. If the dimensions of a pixel was high, they brought it to the present range. They checked if the duvet image maybe a colour image they changed it into the grayscale range. They used APVD algorithm to embed the info into the duvetimage. The result gotten after hiding the info called stego image. They used AES algorithm to encrypt stego image.
In [10], authors conducted a performance analysis survey on various algorithms like DES, AES, RSA combining with LSBsubstitution technique which serves well to draw conclusions on the three encryption techniques supported theirperformances in any application. it's been concluded from their work that AES encryption is best than other techniquesbecause it accounts for fewer encryption, decryption times and uses less buffer space.
In [11], authors performed a contemporary method during which use Huffman encoding to hide data. They took a gray levelimage of size m*n as cover image and p*q as a secret image. then, they executed the Huffman encoding over the key imageand each little bit of Huffman code of a secret image is hidden into a canopy image utilizing LSB algorithm.
2.2 Steganography vs Cryptography
Steganography and Cryptography are used for the purpose of data transmission over an insecure network without the databeing exposed to any unauthorized persons. Steganography embeds the data in a cover image while cryptography encryptsthe data. The advantage of steganography is that the look of doubt for the attacker to suspect the file isn't changed and ibis itwill not raise any that there may be some data hidden unlike cryptography that encrypts the data and sends it to over thenetwork.
2.3 Combination of Steganography and Cryptography
It is noted that steganography and cryptography alone is insufficient for the safety of data, therefore If we combine thesesystems, we will generate more reliable and powerful approach. The combination of these two strategies will enhance the safety of the knowledge secret. This combined will fulfill theprerequisites, for instance, memory space, security, and strength for important information transmission across an openchannel. Also, it'll be a strong mechanism that enables people to speak without interferes with eavesdroppers even knowing there's amethod of communication within the first place.
2.4 AES Algorithm
Advanced Encryption Standard is a symmetric block cipher encryption algorithm that uses a single key to encrypt the data.
Encryption Process
Here, we restrict to description of a typical round of AES encryption. Each round comprise of four sub-processes except forthe last and final round of the algorithm. In the last round of the AES algorithm we will remove one of the transformationcalled mix column transformation. The first round process is depicted below.
Fig. 2 AES round
Byte Substitution (SubBytes)
The 16 input bytes are substituted by looking up a tough and fast table (S-box) given in design. the result is during a matrixof 4 rows and 4 columns.
Shiftrows
Each of the four rows of the matrix is shifted to the left(except the 1st one). Any entries that ‘fall off’ are re-inserted on theright side of row. Shift is run as follows −
1. First row isn't shifted
2. Second row is shifted one(byte) position to the left
3. Third row is shifted two positions to the left
4. Fourth row is shifted three positions to the left
The result's a replacement matrix consisting of the same 16 bytes but shifted with regard to each other .
MixColumns
Each column of 4 bytes is now converted employing a special function . This function takes as input the four bytes of 1column and outputs four completely new bytes, which replace the primary column. the result is another new matrixconsisting of 16 bytes. It should be noted that this step isn't performed within the last round.
Addroundkey
The 16 bytes of the matrix are now considered as 128 bits and are XORed to the 128 bits of the round key. If this is oftenoften the last round then the output is that the ciphertext. Otherwise, the resulting 128 bits are interpreted as 16 bytes whichwe start another similar round.
Decryption Process
The process of decryption of an AES ciphertext is analogous to the encryption process within the reverse order. Each roundconsists of the four processes conducted within the reverse order −
1. Add round key
2. Mix columns
3. Shift rows
4. Byte substitution
Since sub-processes in each round are in reverse manner, unlike for a Feistel Cipher, the encryption and decryptionalgorithms must be separately implemented, although they're very closely related.
2.5 LSB Technique
Images are ideal for information hiding due to the massive amount of dispensable space is made within the storing ofimages.The most common and popular method of modern-day steganography is to form use of LSB of picture’s pixel information.This system works best when the file is longer than the message file and if image is graysscale. When applying LSBtechniques to every byte of a 24bit image, three bits are often encoded into each pixel. If the LSB of the pixel value ofcanopy image C(i,j) is adequate to the message bit SM of secret message to be embedded, C(i,j) remain unchanged, if notset the LSB of C(i,j) to SM.Message embedding process is given:S(i,j) = C(i,j) – 1, if LSB(C(i,j)) = 1 and SM = 0.S(i,j) = C(i,j) + 1, if LSB(C(i,j)) = 0 and SM = 1.S(i,j) = C(i,j) , if LSB(C(i,j)) = SM
Where LSB(C(i,j)) stands for the LSB of canopy image C(i,j) and “SM” is that the next message bit to be embedded. S(i,j)is that the stego image. Many variations of this LSB algorithm are often used one such example is given below-
We can use images to hide things if we replace the last bit of every colors byte with a bit from the message.Message A- 01000001Image with 3 pixelsPixel 1: 11011000 11001001 00000011Pixel 2: 11011000 11001001 00000011
Pixel 3: 11011000 11001001 00000011
Now we hide our message in the image.Message: 01000001Pixel 1: 11011000 11001001 00000010Pixel 2: 11011000 11001000 00000010Pixel 3: 11011000 11001001 00000011
3. METHODOLOGY
3.1 Real-Time Problem Solution
The intrinsic issue with the image security in today scenario is, there's no proper secured channels through which the imageare often sent from the sender to the receiver. Therefore the modules in our present provides the integrity and confidentialityto the users by using the mixture of encryption and hiding the image.
3.2 System Architecture
Fig. 3 Sender side
Fig. 4 Receiver side
At the sender the received secret image is encrypted using the symmetric algorithm AES with a personal key. Further theencrypted data of the image is hidden inside the duvet image using the steganographic method LSB.In a similar way the key image is extracted from the duvet image within the receiver side.
3.3 Module Division
There are three modules within the methodology.
1. Image-Hexdata2. Encryption-Decryption3. Hiding-Extracting
Fig. 5 Module flow
Image-Hexdata
In this module the image data is converted into the Hex format at the sender side to supply the info to the encryptionalgorithm for encryption.Similarly, at the receiver side the hexdata is converted because the image format .
Encryption-Decryption
In this module the hex data generated at the sender side is encrypted using the AES algorithm.And the extracted data,(i.e. encrypted) at the receiver side is then decrypted using the decryption AES algorithm.
Fig. 6 Encryption
Fig. 7 Decryption
Hiding-Extracting
In this module the encrypted data from the AES encryption algorithm is stored inside the duvet image using the LSBsteganographic method.And at the receiver side the encrypted data is extracted from the duvet image using the LSB extraction method.
Fig. 8 Steganography
4. CONCLUSION
In this project, we've taken the matter of sharing the pictures within the public channels. It is known that the layman totechnology uses the general public channels aren't secured to the extent to satisfy the confidentiality and integrity to theuser. Many steganography methods are been used to hide the secret images inside the cover images that are been transmittedinto the insecure channels. However, using the steganographic methods alone may lead to extraction of the secret imageswith the known method of hiding. Hence, in this project we have used the combined method of hiding the encrypted imageinto the cover image. Therefore, even in the scenario where the hacker can extract the hidden data, fails to decrypt the datato form the original secret image. By consolidating the two methods of cryptography and steganography, the safety of imagetransfer through the insecure channels is achieved.
5. REFERENCES
[1] J. K. Saini and H. K. Verma, “A hybrid approach for image security bycombining encryption and steganography,” in Image Information Processing(ICIIP), 2013 IEEE Second International Conference on IEEE, 2013, pp. 607–611.
[2] P. Kumar and V. K. Sharma, “Information security based on steganography &cryptography techniques: A review,” International Journal, vol. 4, no. 10, 2014.
[3] H. Sharma, K. K. Sharma, and S. Chauhan, “Steganography techniques usingcryptography-a review paper,” 2014.
[4] A. Dhamija and V. Dhaka, “A novel cryptographic and steganographic approachfor secure cloud data migration,” in Green Computing and Internet of Things(ICGCIoT), 2015 International Conference on. IEEE, 2015, pp. 346–351.
[5] P. Vijayakumar, V. Vijayalakshmi, and G. Zayaraz, “An improved level ofsecurity for dna steganography using hyperelliptic curve cryptography,” WirelessPersonal Communications, pp. 1–22, 2016.
[6] S. S. Patil and S. Goud, “Enhanced multi level secret data hiding,” 2016.
[7] B. Karthikeyan, A. C. Kosaraju, and S. Gupta, “Enhanced security insteganography using encryption and quick response code,” in WirelessCommunications, Signal Processing and Networking (WiSPNET), InternationalConference on. IEEE, 2016, pp. 2308–2312.
[8] B. Pillai, M. Mounika, P. J. Rao, and P. Sriram, “Image steganography methodusing k-means clustering and encryption techniques,” in Advances in Computing,Communications and Informatics (ICACCI), 2016 International Conference on.IEEE, 2016, pp. 1206–1211.
[9] F. Joseph and A. P. S. Sivakumar, “Advanced security enhancement of databefore distribution,” 2015.
[10] B. Padmavathi and S. R. Kumari, “A survey on performance analysis of des,aes and rsa algorithm along with lsb substitution,” IJSR, India, 2013.
[11] R. Das and T. Tuithung, “A novel steganography method for image based onhuffman encoding,” in Emerging Trends and Applications in Computer Science(NCETACS), 2012 3rd National Conference on. IEEE, 2012, pp. 14–18.
[12] K. Muhammad, J. Ahmad, M. Sajjad, and M. Zubair, “Secure imagesteganography using cryptography and image transposition,” arXiv preprintarXiv:1510.04413, 2015.
[13] S. E. Thomas, S. T. Philip, S. Nazar, A. Mathew, and N. Joseph, “Advancedcryptographic steganography using multimedia files,” in International Conferenceon Electrical Engineering and Computer Science (ICEECS-2012), 2012.
[14] A. Gambhir and A. R. Mishra, “A new data hiding technique with multilayersecurity system.” 2015.
[15] M. H. Sharma, M. MithleshArya, and M. D. Goyal, “Secure image hidingalgorithm using cryptography and steganography,” IOSR Journal of ComputerEngineering (IOSR-JCE) e-ISSN, pp. 2278–0661, 2013.
[16] Seyed Hossein Kamali, Reza Shakerian “A New Modified Version of