Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 42

CHAPTER ONE

INTRODUCTION

Digital communication witnesses a noticeable and continuous development in


many applications in the Internet. Hence, secure communication sessions must be
provided. The security of data transmitted across a global network has turned into a
key factor on the network performance measures. So, the confidentiality and the
integrity of data are needed to prevent eavesdroppers from accessing and using
transmitted data. Steganography and Cryptography are two important techniques
that are used to provide network security. Artificial neural network (ANNs) is a
computing system inspired by the biological neural networks that constitute animal
brains. The aim of this project is to develop a new approach to hiding a secret
information in an image, by taking advantage of benefits of combining
cryptography and steganography and then training a neural network to achieve this
using machine learning.

1.1 CRYPTOGRAPHY

Cryptography is one of the traditional methods used to guarantee the privacy of


communication between parties. This method is the art of secret writing, which is
used to encrypt the plaintext with a key into ciphertext to be transferred between
parties on an insecure channel. Using a valid key, the ciphertext can be decrypted
to the original plaintext. Without the knowledge of the key, nobody can retrieve the
plaintext. Cryptography plays an essential role in many factors required for secure
communication across an insecure channel, like confidentiality, privacy, non-
repudiation, key exchange, and authentication.

1
Fig 1.1. Cryptography as a flow model.

1.1.1 SYMMETRIC / SECRET KEY CRYPTOGRAPHY

The technique of Secret key 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 sides encryption and decryption of secret data. The original
information or plaintext is encrypted with a key by the sender side also the
similarly key is used by the receiver to decrypt a message to obtain the plaintext.
the key will be known only by a people who are authorized to the
encryption/decryption. However, the technique affords the good security for
transmission but there is a difficulty with the distribution of the key. If one stole or
explore the key, he can get whole data without any difficulty. An example of
Symmetric-Key is DES Algorithm.

1.1.2 ASYMMETRIC / PUBLIC KEY CRYPTOGRAPHY

We can call this technique as asymmetric cryptosystem or public key


cryptosystem, this technique uses two keys which are mathematically associated,
use separately for encrypting and decrypting the information. In this technique,

2
when we use the private key, there are no possibilities to obtain the data or simply
discover the other key. The key used for encryption is stored public therefore it’s
called public key, and the decryption key is stored secret and called private key.
An example of Asymmetric-Key Algorithm is RSA.

1.2 STEGANOGRAPHY

It can be defined as the science of hiding and communicating data through


apparently reliable carriers in attempt to hide the existence of the data. So, there is
no knowledge of the existence of the message in the first place. If a person views
the cover which the information is hidden inside, he or she will have no clue that
there is any covering data, in this way the individual won’t endeavour to decode
the data. The secret information can be inserted into the cover media by the stego
system encoder with using certain algorithm. A secret message can be plaintext, an
image, ciphertext, or anything which can be represented in form of a bitstream.
after the secret data is embedded in the cover object, the cover object will be called
as a stego object also the stego object sends to the receiver by selecting the suitable
channel, where decoder system is used with the same stego method for obtaining
original information as the sender would like to transfer.

3
Fig 1.2. Stegonography as a flow model.

1.2.1 TYPES OF STEGANOGRAPHY

There are various types of steganography.

 Text Files
The technique of embedding secret data inside a text is identified as text stego.
Text steganography needs a low memory because this type of file can only store
text files. It affords fast transfer or communication of files from a sender to
receiver.
 Image Files
It is the procedure in which we embed the information inside the pixels of
image. So, that the attackers cannot observe any change in the cover image.
LSB approach is a common image steganography algorithm.
 Audio Files
It is the process in which we hide the information inside an audio. There are
many approaches to hide secret information in an audio files for examples
Phase Coding, LSB.

4
 Video Files
It is the process of hiding some secret data inside the frames of a video.
1.2.2 APPLICATIONS OF STEGANOGRAPHY
 Secret Communication: Steganography does not advertise secret
communication and therefore avoids scrutiny of the sender message. A trade
secret, blueprint, or other sensitive information can be transmitted without
alerting potential attackers.
 Feature Tagging: Elements can be embedded inside an image, such as the
names of the individuals in a photo or location in a map. Copying the stego
image also copies all of the embedded features and only parties who possess
the decode stego key will be able to extract and view the features.
 Copyright Protection: Copy protection mechanisms that prevent the data,
usually digital data from being copied. The insertion and analysis of water
marks to protect copyrighted material is responsible for the percent rise of
interest digital steganography and data embedding.

1.3 STEGANOGRAPHY VERSUS 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 the file isn’t
changed and this it will not raise any doubt for the attacker to suspect that there
may be some data hidden unlike cryptography that encrypts the data and sends it to
network.

1.4 BENEFITS OF STEGANOGRAPHY AND CRYPTOGRAPHY

5
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 of these two strategies will
improve the security of the information. This combined will fulfill the
prerequisites, for example, memory space, security, and strength for important
information transmission across an open channel. 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 ARTIFICIAL NEURAL NETWORK

Work on artificial neural network has been motivated right from its inception by
the recognition that the human brain computes in an entirely different way from the
conventional digital computer. The brain is a highly complex, nonlinear and
parallel information processing system. It has the capability to organize its
structural constituents, known as neurons, so as to perform certain computations
many times faster than the fastest digital computer in existence today. The brain
routinely accomplishes perceptual recognition tasks, e.g. recognizing a familiar
face embedded in an unfamiliar scene, in approximately 100-200 ms, whereas
tasks of much lesser complexity may take days on a conventional computer. [1]

A neural network is a machine that is designed to model the way in which the
brain performs a particular task. The network is implemented by using electronic
components or is simulated in software on a digital computer. A neural network is
a massively parallel distributed processor made up of simple processing units,
which has a natural propensity for storing experimental knowledge and making it
available for use. It resembles the brain in two respects:

6
1. Knowledge is acquired by the network from its environment through a
learning process.
2. Interneuron connection strengths, known as synaptic weights, are used to store
the acquired knowledge.

Neural networks, with their remarkable ability to derive meaning from


complicated or imprecise data, can be used to extract patterns and detect trends that
are too complex to be noticed by either humans or other computer techniques.

1.5.1 ADVANTAGES OF NEURAL NETWORKS

 Adaptive learning: An ability to learn how to do tasks based on the data


given for training or initial experience.
 Self-Organization: An ANN can create its own organization or
representation of the information it receives during learning time.
 Real Time Operation: ANN computations may be carried out in parallel,
and special hardware devices are being designed and manufactured which
take advantage of this capability.

1.5.2 BIOLOGICAL MODEL

The human nervous system can be broken down into three stages that may be
represented as follows:

Fig 1.3. Block diagram of a Human Nervous System

7
The receptors collect information from the environment. The effectors generate
interactions with the environment e.g. activate muscles. The flow of
information/activation is represented by arrows. There is a hierarchy of interwoven
levels of organization:

 Molecules and Ions


 Synapses
 Neuronal microcircuits
 Dendritic trees
 Neurons
 Local circuits
 Inter-regional circuits
 Central nervous system

There are approximately 10 billion neurons in the human cortex. Each biological
neuron is connected to several thousands of other neurons. The typical operating
speed of biological neurons is measured in milliseconds.

The majority of neurons encode their activations or outputs as a series of brief


electrical pulses. The neuron’s cell body processes the incoming activations and
converts the into output activations. The neurons nucleus contains the genetic
material in the form of DNA. This exists in most types of cells. Dendrites are fibers
which emanate from the cell body and provide the receptive zones that receive
activation from other neurons. Axons are fibers acting as transmission lines that
send activation to other neurons. The junctions that allow signal transmission
between axons and dendrites are called synapses.

8
fig 1.4. Schematic diagram of a Biological Neuron

1.5.3 TRAINING OF ARTIFICIAL NEURAL NETWORKS

A neural network has to be configured such that the application of a set of inputs
produces (either 'direct' or via a relaxation process) the desired set of outputs.
Various methods to set the strengths of the connections exist. One way is to set the
weights explicitly, using a priori knowledge. Another way is to 'train' the neural
network by feeding it teaching patterns and letting it change its weights according
to some learning rule that we will set up using the Python programming language.

1.6 PROPOSED PLAN OF WORK

Encryption has been the way to establish a secure connection for a couple of
years. It is secure, computationally efficient and almost supported by every
platform. But a downside of the encryption is that an encrypted message is
meaningless. It is a bunch of non-sense bits or characters that are not interpretable

9
by any human. This project intends to design and train a neural network. It’ll
encrypt and decrypt messages while the ciphers are understandable by human.
More specifically, each cipher is an image and the message is embedded in it.
Given the new image, the other part of the network can extract the message
(sentence) from the image.

Fig 1.5. The whole idea

When we start off with our neural network we initialize our weights randomly.
Obviously, it won’t give you very good results. In the process of training, we want
to start with a bad performing neural network and wind up with network with high
accuracy. In terms of loss function, we want our loss function to much lower in the
end of training. Improving the network is possible, because we can change its
function by adjusting weights. We want to find another function that performs
better than the initial one.

The network is divided into two parts:

 Encoder: It takes an image and a tokenized text and embeds the tokenized text
into the image.
 Decoder: It takes the encoder’s output (the new image) and extracts the
tokenized text from it. We use randomly generated images as the network
must work with any images. It is the same story for messages as well. Instead

10
of actual texts, we use random integers to represent a tokenized message.
Hopefully, a converged model can operate on actual images and texts.

We use randomly generated images as the network must work with any images. It
is the same story for messages as well. Instead of actual texts, we use random
integers to represent a tokenized message. Hopefully, a converged model can
operate on actual images and texts.

11
CHAPTER TWO
LITERATURE REVIEW

Various cryptography and steganography techniques have been around since they
were introduced. Also, there are many hybrid techniques proposed for combining
cryptography and steganography and in addition to that in the recent years,
techniques to implement steganography using neural networks are also published
A deep and detailed review was performed. This literature review section is
divided into 5 sub-sections New Cryptography techniques, Steganography
techniques, learning different neural networks, Combination of Cryptography and
Steganography and the last one is implementing steganography using neural
networks.

2.1 CRYPTOGRAPHY TECHNIQUES

Cryptography has been around since a long time and there have been many good
techniques and in the following paper (Emori, 1973) author performs an
experiment on three encryption techniques namely AES, DES and RSA, these
three techniques are widely used for end-toencryption in most of the applications.
Authors performed a thorough analysis on all three techniques with their designed
experiment and compared the results in the paper and determined that AES
algorithm is much better than the other two techniques. (Rothke, 2007) AES was
officially announced as Federal Information Processing Standards Publications by
NIST in the year 2001. The paper explains in detailed specification,
implementation, and applications of the AES encryption standard and (Daemen
and Rijmen, 1999) shows the math behind the techniques. This paper explains
every part of AES working along with the calculations included with it. These two

12
papers clearly explained the AES technique. (Bidhuri and Heffernan, 2019) the
author describes a hybrid technique of AES encryption and Scrypt. Scrypt is a
password based key derivative function which helps to enhance the strength of a
password to withstand against the attacks.

2.2 STEGANOGRAPHY

In (Altaay, Sahib and Zamani, 2012) author gives an in-depth explanation


steganography. The paper covers all the aspects of steganography starting from
important measurements such as the capacity of an image to hide data without
getting distortions these can be defined by the Mean square error(MSE) or Peak
Signal to Noise Ratio (PSNR); Robustness, which is strength of any image to keep
hidden data undistorted against the disturbances and distortions while being
transmitted and lastly the authenticity of image. (Bansal et al., 2015) the author
gives a detailed idea of multiple steganography techniques used for the purpose of
hiding data in Images. (Khan and Jeoti, 2010) The author proposed a novel
technique to blind watermark an image using the bit plane of DC component in an
image. In this paper the author used DC component in the bit plane of an image to
watermark the image. The image is watermarked at random positions on the DC
components in Bit-plane. These random positions are generated by a scrambler.
The best feature of the technique is that it does not require the original image to
check for the watermark and hence this is what makes the technique a blind
watermarking technique making it unique.

2.3 UNDERSTANDING THE NEURAL NETWORKS

(Canziani, Paszke and Culurciello, 2016) author performs a detailed analysis of


all the necessary metrics of multiple deep neural networks models and compares
and explains the architecture, power consumption, accuracy of the particular

13
models. The paper provides some significant set of data which definitely helps in
choosing a perfect model for any application. (Wei et al., 1998) the author
describes Artificial neural networks very well, starting from the basic question
“What is Artificial neural network. The author clearly depicts the working of an
ANN and how it can be put to use in various filed with an example of ANN being
used in the medical field.

Similar to the previous paper this is also a research paper to understand the basic
working of (Albawi, Mohammed and Al-Zawi, 2018) Convolution Neural
Network. The author very well describes all the aspects of a CNN right from it
meaning, idea, technologies used, working and the mathematical approach taken to
design a CNN. After carefully reviewing these three types of Neural network it
was pretty obvious the CNN has most applications in field of image processing and
image recognition, face generations and many more.

2.4 COMBINATION OF STEGANOGRAPHY AND CRYPTOGRAPHY

(Pujari and Shinde, 2016) proposes a technique to enhance steganography along


with cryptography, here the author designed a hybrid encryption technique using
more than one cryptographic scheme such as AES, RC2, Blowfish. To make this
more secured author adds a second layer of security; this second layer is to use
image steganography technique LSB in addition with the parity check. The
architecture of the proposed method is such that it is divided in three steps. First it
takes the message and encrypts using multiple hybrid cryptographic schemes,
second is that it hides all the encrypted text inside an image using LSB and parity
checker steganography techniques. The final step is that author evaluated all the
encrypted images with different techniques based on their Peak-Signal-to-Noise
ratio PSNR and the technique with best PSNR gets transmitter.

14
(Atee, Ahmad and Noor, 2014) author has focused on the most important
drawback of cryptography and steganography techniques. The biggest drawback of
cryptography is that once a text is encrypted with a cryptographic technique it gets
converted into random stream of alphabet, number, and symbols and the drawback
with steganography is that it mostly encrypts the data in plaintext. Which makes it
very easy to break and get the data from inside. Therefore, author proposes a
technique which flows like using AES encryption to encrypt the data and then
hiding this encrypted text inside an image using Pixel value differencing. The
proposed technique achieves the double layer of security, but the technique inly
implemented on grey scale images.

(Oo and Aung, 2020) Author purported a secured method comprising of


combination of both cryptography and steganography for the for the
communication over multimedia channels. The writer makes use of AES algorithm
in combination with CBC which is then encoded inside and image achieving
coloured image steganography. In the sphere of wireless communication, (Eyssa,
Abdelsamie and Abdelnaiem, 2020) has recommended a robust Steganography
approach. Discrete Cosine Transform (DCT) and Discrete Wavelet Transform
(DWT) are used to encrypt three images into a single mask image, increasing the
hiding capacity (DWT). Cover photos have been subjected to a variety of
permutations and transformations in order to improve image deterioration
tolerance. This method is done using Orthogonal Frequency Division Multiplexing
(OFDM), and the results outperform existing techniques using the Least
Significant Bit (LSB) and PSNR as assessment metrics.

This paper (Pradhan et al., 2016) focuses on three specific parameters considered
for performing evaluation for various Image Steganography techniques. Hiding
Capacity within an Image, Distortion Measure of Images and Security

15
implemented for Encryption are the parameters specified in the paper. Evaluation
Metrics such as MSE, PSNR, quality index, correlation, SSIM, etc. are considered
to measure distortion within images and the security for the resultant container
images have been displayed using Histograms focusing on pixel differences. Using
these parameters, authors have successfully evaluated different steganographic
algorithms and focuses to explore different areas such as LSB, PVD, etc. In this
study (Shaik, Thanikaiselvan and Amitharajan, 2017), different Data Hiding
strategies based on Cryptography and Steganography are discussed. The author
focuses on several properties of Data Hiding with Steganography and assesses
them using a variety of criteria such as Bit Error Rate (BER), PSNR, SSIM, and
others to get satisfactory results. Using these evaluation factors, the paper also
directs on Spatial Image Hiding and Steganalysis. The features of Hiding are being
studied in order to increase Robustness and Accuracy in the future.

2.5 STEGANOGRAPHY USING NEURAL NETWORKS

(Das et al., 2021) showcases a unique technique of Steganography which


comprises of three neural networks which work together to encode images within
images and the reveal back the hidden image. Deep neural networks are used in all
the three phases of the paper to hide and reveal the images. The author further
extends work from single images to multiple images using same network. This was
done after remarkable results were achieved in terms of Peak Signal to Noise ratio
and Accuracy. Author intends to overcome the limitations of the techniques in
terms of colour regeneration for hidden images in the future work of the research.
To tackle the problems of hiding multiple images into one carrier. To deal with the
problems of concealing more than one image inside a single carrier, (Duan, Liu, et
al., 2020) came up with a solution by using a convolution neural network (CNN).
The paper depicts two ML models each dedicated for encoding and decoding

16
images at a same time. To negate the issue of image regeneration both of these
models are trained with a large number of images. Authors successfully achieved
the execution of image steganography using convolution neural network and
compared this model with ResNet and Unet on the basis of PSNR ratio. Authors
described the future scope of the paper as their intentions to overcome time and
space constraints in relation with decryption process and the process of hiding
image.

With a goal to accomplishing better and improved image visualisation in the field
of steganography, (Duan, Guo, et al., 2020) puts forwards a novel technique of
using Discrete Cosine Transform (DCT) for the purpose of conversion of original
images into secret image. This particular technique uses multi-level steganography
after the conversion of first layer of steganography and after that the Elliptical
curve cryptography. (ECC) to encrypt the image and the make use of the hiding
network to create a container image. This particular technique is double layer data
security along with the improvised image visuality by using deep neural network
named SegNet in the hidden network section. The results of this technique are
evaluated on the basis of Structural Similarity Index and the peal-signal-to-noise
ratio. This research paper () focused on mentioning various implementation
procedures in the field of steganography and steganalysis using CNN deep
convolution neural networks. Author has beautifully pointed of advantages and
disadvantages of multiple techniques in the field. Author had done a perfectly good
job of guiding new aspiring researchers in right direction by supplying with proper
resources and hypothesis by optimizing results and thereby optimizing neural
networks.

To uncover secret information and check for steganographic images (Oplatková


et al., 2009) proposed a novel technique, making use of neural network-based

17
image steganography method of displaying encoded message. OutGuess and
Steghide were used to program the model and to train itself to produce maximum
output. These models provided considerably high accuracy in comparison to the
traditional revealing network. Evaluation of these model was performed on the
basis of root mean square error (RMSE). Even though the proposed models
performed excellent in accuracy, but these models did not perform well in terms of
alterations of hidden layers and improving that was the main focus on authors in
future works. (Hussain et al., 2020) used four Artificial Neural networks (ANN) to
implement steganography over sensitive information inside an image. The main
reason to choose ANN in place of any other neural network is to implement Scaled
Conjugate Gradient (SCG) technique. This technique helped in perfecting the
hiding of secret image in container image without leaving any errors. Evaluation of
this method was performed by MSE and PSNR. A strong method of image
steganography by () in respect to the field of wireless communication. The
proposed method uses DCT and DWT to hide three secret images in a single cover
image thus, increasing the hiding capacity of and image. The technique was
employed over Orthogonal Frequency Division multiplexing and the output of this
technique surpassed the results of previously used LSB based methods.

18
CHAPTER THREE
SYSTEM ANALYSIS AND DESIGN

3.1. ARTIFICIAL NEURAL NETWORK

Artificial Neural Network (ANN) is a progression of an algorithm that behaves


like a human sensory system [1]. An ANN embodies a huge number of
interconnected processing units called nodes (neurons) that work collaboratively to
solve a fastidious errand. In a similar fashion to our brain, the nodes work in
parallel and each node collects input from others. The nodes then compute these
inputs and pass on the data to the next connected node. Neural networks learn to
perform tasks by analyzing pre-defined data. Convolutional Neural Network
(CNN) is one of the widely used algorithms for Neural Networks. CNN or
ConvNet is mostly used to analyze images. CNN's allow us to encode image-
specific features into the architecture, making the network more fitting for the
tasks, handling the images - whilst reducing the parameters required to set up the
model. A better understanding can be found in [2], [3].

3.1.1. CONVOLUTIONAL NEURAL NETWORK

CNNs are very powerful neural networks that can be classified as a regularized
version of Multilayer Perceptrons or MLP [4]. The name “convolutional neural
network” indicates that the network employs a mathematical operation called
convolution [5]. Convolution is a specific kind of linear operation that expresses

19
the amount of overlap of one function as it is shifted over another function.
Convolutional networks are simply neural networks that use convolution in place
of general matrix multiplication in at least one of their layers [6]-[8]. Reported
studies [9]-[11] suggest that CNN based architecture for encoding and decoding
features have the following advantages:

 CNN extract features of the images automatically.


 CNN effectively uses adjacent pixel information to effectively downsample
the image first by convolution and then uses a prediction layer at the end.
 CNN performs well and gives better accuracy.

Using a deep neural network, CNN, in this case, one will be able to have a good
sense of the patterns of natural images. The network will be able to make
judgments on which area is redundant, and more pixels can be hidden there. By
conserving the space on unnecessary areas, the amount of hidden data can be
increased. Since the structure and the weights can be randomized, the network will
hide the data that cannot be known to anybody who doesn't have the weights [12],
[13].

3.2. ARCHITECTURE

The network architecture is somewhat similar to Auto-Encoders [14]. In general,


Auto-Encoders are used to reproduce the input ensuing a set of transformations. By
performing this, they learn about the characteristics of the input distribution. But in
our illustration, the proposed architecture is marginally distinct. Rather than simply
procreating images, the network has to conceal an image, additionally procreate
another image. The proposed architecture is exhibited in Figure 3.1.

20
fig 3.1. Architecture of the proposed system. Top: Sender Block. Bottom: Receiver Block

The four components shown in Figure 3.1 are trained as a single network but it will
be easier to explain them individually. The first layer, Prep Layer, prepares the
secret image to be hidden. This layer serves various purposes. Firstly, if the secret
image is smaller than the cover image, it increases the size of the secret image to
the size of the cover image, hence distributing the secret image’s bits across the
entire pixels. Furthermore, relevant to all measurements of hidden images, the
purpose is to reconstruct the color-based pixels to more useful features for
succinctly encoding the image such as edges. The most important purpose of this

21
layer was to finally embed the secret image to the encrypted image so as to avoid
any leak of the secret message.

The second layer, Hiding Layer, takes the output of the Prep Layer as input and a
cover image so as to produce the Container Image. The input to this network is a
square pixel image, with depth considered of RGB channels of the cover image
and the reconstructed channels of the secret image. These two layers together form
the Sender Block. The Container image produced can be shared with the receiver.

The third Layer, Reveal Layer, is used by the receiver to produce back the
encrypted image. This layer takes in the Container image as input and removes the
cover image to generate the encrypted secret image.

The fourth Layer, Decrypt Layer, takes in the output of the Reveal Layer and
decrypt the image to finally reveal the secret image. The third and fourth layer
together forms the Receiver Block. As shown by Baluja [15], the loss in the
network can be computed by the given formula:

where the variables are as mentioned in Figure 2. The loss is the conventional
Mean Square Error between the original cover image and the container image, and
β*(MSE between the original secret image and the revealed image). β is a hyper-
parameter that regulates how much the secret image should be restored. Since the
given function is differentiable, the neural network can be trained end-to-end.

3.3 IMAGE ENCRYPTION

Images are widely used as part of communication since they are more effortless to
process than text. As explained by Kumar et al. [16], the user might communicate

22
on a network that is compromised and security of the information becomes crucial
in such cases. Hence, encryption or the scheme used to transform an image into
another image that is not easily comprehensible [17], [18] is important to maintain
the security of the information being communicated. Image encryption has
applications in various areas - for example, military, security agencies or wherever
the data is sensitive or contains privileged information. Image Encryption methods
or algorithms revolve around the following three ideas:

 Pixel Permutation - Scrambling the pixels


 Pixel Substitution - Modifying each pixel value
 Visual Alteration

An image histogram is one of the security parameters kept in consideration for


encryption methods as explained by Li et al. [19]. The histogram displays the
frequency distribution and provides an insight into the frequency of each pixel
value. In the various encryption methods as explained by Khan and Shah [20],
methods based on the transformation of pixel values for example - AES (Advanced
Encryption System) tend to create a uniform image histogram that protects it from
plain text attack but requires zero loss while decrypting the image. This is not
useful in this case as the neural network used (to hide images in other images)
depends on the redundant area in the cover images which in turn gives the amount
of hidden data. Similarly, ECC (Elliptic Curve Cryptography) as explained by
Geetha et al. [21] cannot be used in our scenario. Due to the data loss in the neural
networks, methods like AES and ECC fail. Hence, one can use methods based on
scrambling of data (in this case pixels) retaining the same pixel value but at a
different location giving the same histogram [22]. The scrambling helps in
providing the same histogram but decreases the correlation between pixels. In this
paper, scrambling or shuffling blocks of pixels technique is used [23]. As

23
discussed by Kumar et al. [16], displacement techniques give the same image
histogram but a reduced correlation between adjacent pixels of the image as
illustrated in Figure 3.

fig 3.2. Histogram comparison of the original and encrypted image

As the number of blocks increases, the correlation decreases giving a suitable


encryption layer. The number of blocks can be referred to as the order of
encryption. By increasing the order of encryption it is observed that one cannot

24
interpret the significance of the image just by looking at it. Figure 3.3 depicts the
effect of the increasing order of encryption.

After experimenting, it is observed that the order of encryption 196 gives the most
suitable level of encryption and low correlation. Moreover, 196 blocks of pixels
mean 196! ways to arrange them. This gives ≅ 5.08 x 10365 number of
permutations and considering a computer does 1016 calculations per second then it
will take about ≅ 10342 years to find the right permutation. Hence it is used as the
first layer of encryption in the network.

25
fig 3.3. Encryption order (increasing left to right) of secret image comparison chart

3.4. INTEGRATING NEURAL NETWORKS WITH ENCRYPTION

3.4.1 EXPERIMENTAL CONFIGURATION

Python programming language is used to train the model. Pycharm is the


preferred IDE because It offers a ton of benefits, saving users a lot of time by

26
helping with routine tasks. Model was developed using libraries including
Tensorflow, Keras, Matplotlib, Numpy, etc

3.5 HARDWARE REQUIREMENTS

 Processor : Any processor above 1 GHz


 RAM : 4 GB
 Hard Disk : 10 GB
 Input device : Mouse and Keyboard
 Output device : Monitor or display

3.6 DESIGN

3.6.1 CLASS DIAGRAM

Class diagram describes the attributes and operations of a class and also the
constraints imposed on the system. The class diagrams are widely used in the
modelling of object-oriented systems because they are the only UML diagrams,
which can be mapped directly with object-oriented languages.

27
fig 3.4. Class diagram

3.6.2 USE CASE DIAGRAM

To model the functionality of a system, use case diagrams are used. A use case is
a system response to an event that an external agent (actor) triggers. The use case
diagram shows the various actors, use cases and their interactions. The use case
diagram for this project is given below:

28
Fig 3.5 Use Case diagram

3.6.3 SEQUENCE DIAGRAM

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. Sequence diagrams are typically associated with use case realizations
in the Logical View of the system under development. Sequence diagrams are
sometimes called event diagrams or event scenarios.

A sequence diagram shows, as parallel vertical lines, different processes or objects


that live simultaneously and as horizontal arrows, the messages exchanged
between them, in the order in which they occur. This allows the specification of
simple runtime scenarios in a graphical manner.

29
Fig 3.6. Sequential diagram

30
CHAPTER FOUR
IMPLEMENTATION

This is where we’ll design and train a neural network. It encrypts and decrypts
messages while the ciphers are understandable by human. More specifically, each
cipher is an image and the message is embedded in it. Given the new image, the
other part of the network can extract the message (sentence) from the image.

To generate random images, we use:

def rand_img(size):
return np.random.randint(0, 256, size) / 255.0

And the following code is used to generate random character messages:

def rand_sentence(len, max):


return np.random.randint(0, max, len)
A sample of random sentence is like:

@\x8eUÍbâºq÷3\x8b¸|¼Ó\x91æíÃtÉ/LO¤_

Now, we can create a generator that always generates a new batch of random
images and messages.

def data_generator(image_size, sentence_len,


sentence_max_word, batch_size=32):
while True:
x_img = np.zeros((batch_size, image_size[0],
image_size[1], image_size[2]))
x_sen = np.zeros((batch_size, sentence_len))
y_img = np.zeros((batch_size, image_size[0],
image_size[1], image_size[2]))

31
y_sen = np.zeros((batch_size, sentence_len,
sentence_max_word))
for i in range(batch_size):
img = rand_img(image_size)
sentence = rand_sentence(sentence_len,
sentence_max_word)
sentence_onehot = onehot(sentence,
sentence_max_word)
x_img[i] = img
x_sen[i] = sentence
y_img[i] = img
y_sen[i] = sentence_onehot
yield [x_img, x_sen], [y_img, y_sen]

The data is ready now. We may now implement our model. The input image size is
(100, 100) while the text length is 100. First, we use a 2D convolutional layer with
the kernel size of (1,1) and filter count of 20 activated by ReLU on the image.
Then, we embed each element (character) of the sequence to a new space with one
hundred dimensions. The size of the embedded sequence is (100, 100) now. Next,
we attach the embedded sequence to the image in the third axis. The shape of the
new tensor is (100, 100, 21). A (1,1) convolutional layer with three filters is now
used to reconstruct the image from the new tensor. After that, we input the
reconstructed image to a (1, 1) convolutional layer with one filter. The output’s
shape is (100, 100, 1). We can assume that this is a sequence of one hundred
characters each on being in a one hundred dimensions space. Subsequently, we use
a fully-connected layer followed by softmax activation to map each character to

32
the dictionary space. We expect the model to reconstruct each character (token) as
a one hot vector. The following image visualizes the model.

fig 4.1: Model visualization

33
The following code is the Keras implementation of the model:

def get_model(image_shape, sentence_len, max_word):


input_img = Input(image_shape)
input_sen = Input((sentence_len,))
embed_sen = Embedding(max_word, 100)(input_sen)
flat_emb_sen = Flatten()(embed_sen)
flat_emb_sen = Reshape((image_shape[0],
image_shape[1], 1))(flat_emb_sen)
trans_input_img = Conv2D(20, 1, activation="relu")
(input_img)
enc_input = Concatenate(axis=-1)([flat_emb_sen,
trans_input_img])
out_img = Conv2D(3, 1, activation='relu',
name='image_reconstruction')(enc_input)
decoder_model =
Sequential(name="sentence_reconstruction")
decoder_model.add(Conv2D(1, 1, input_shape=(100,
100, 3)))
decoder_model.add(Reshape((sentence_len, 100)))
decoder_model.add(TimeDistributed(Dense(max_word,
activation="softmax")))
out_sen = decoder_model(out_img)
model = Model(inputs=[input_img, input_sen],
outputs=[out_img, out_sen])
model.compile('adam', loss=[mean_absolute_error,
categorical_crossentropy],
metrics={'sentence_reconstruction':

34
categorical_accuracy})
encoder_model = Model(inputs=[input_img,
input_sen], outputs=[out_img])
return model, encoder_model, decoder_model

After all the hard works, we can train the model now:

image_shape = (100, 100, 3)


sentence_len = 100
max_word = 256
gen = data_generator(image_shape, sentence_len,
max_word, 64)
model, encoder, decoder = get_model(image_shape,
sentence_len, max_word)
try:
model.load_weights("best_weights.h5")
except:
model.fit(gen, epochs=100, steps_per_epoch=348,
callbacks=[

ModelCheckpoint("best_weights.h5",monitor="loss",
verbose=1,
save_weights_only=True,
save_best_only=True)]
)

35
Fig 4.2: Training the neural network

After training for 100 epochs, the model has a reasonable accuracy. The sum of
absolute error of image reconstruction is 0.01 while the characters are
reconstructed at 100%. Before testing model, we need two more functions to
encode and decode the sentence to and from ASCII.

def ascii_encode(message, sentence_len):


sen = np.zeros((1, sentence_len))
for i, a in enumerate(message.encode("ascii")):
sen[0, i] = a
return sen

def ascii_decode(message):
return ''.join(chr(int(a)) for a in
message[0].argmax(-1))

It is time to test the model on real-world data. We must choose a sentence and an
image. We choose the most popular sentence in programming:

HELLO WORLD

36
and for the image, we use an image that has a dimension of 100 x 100. The
following code is used to embedding and extracting the message:

model.load_weights("best_weights.h5")
img = np.expand_dims(img_to_array(load_img("test_image.jpg")) /
255.0, axis=0)
sen = ascii_encode('HELLO WORLD')
y_img = encoder.predict([img, sen])
y_sen = decoder.predict(y_img)
dec_sen = ascii_decode(y_sen)

RESULT:

The decoded sentence is:

HELLO WORLD

which is exactly the same as the input. The images (with and without embedded
message) are:

Fig: 4.3: Result

Between two images, the average color change in a pixel is 1.67 which is
distinguishable by a normal human eye.

37
CHAPTER FIVE
CONCLUSION

We’ve successfully trained a neural network that can embed any message into
any image by making small changes in the image that are visible to human eyes.
The data is hidden in the image so there will be no chances for the attacker to know
that data is being hidden in the image. We performed our method on image by
implementing a program written in Python language. The method proposed has
proved successful in hiding various types of text in color images.

This work presents a scheme that can transmit large quantities of secret
information and provides secure communication between two private parties. Both
steganography and cryptography can be woven in this scheme to make the
detection more complicated. Any kind of text data can be employed as secret msg.
The secret message employing the concept of steganography is sent over the
network. In addition, the proposed procedure is simple and easy to implement.

Results achieved indicate that our proposed method is encouraging in terms of


security, and robustness.

38
REFERENCES

[1] Basheer, I. A., & Hajmeer, M. (2000). Artificial neural networks:


fundamentals, computing, design, and application. Journal of microbiological
methods, 43(1), 3-31. https://doi.org/10.1016/S0167-7012(00)00201-3 [19] Yao,
X. (1999). Evolving artificial neural networks. Proceedings of the IEEE, 87(9),
1423-1447. https://doi.org/10.1109/5.784219 [20] Zurada, J. M. (1992).
Introduction to artificial neural systems (Vol. 8). St. Paul: West publishing
company.

[2] Gardner, M. W., & Dorling, S. R. (1998). Artificial neural networks (the
multilayer perceptron)-a review of applications in the atmospheric sciences.
Atmospheric environment, 32(14-15), 2627-2636. https://doi.org/10.1016/S1352-
2310(97)00447-0

[3] O'Shea, Keiron & Nash, Ryan. (2015). An Introduction to Convolutional


Neural Networks. ArXiv e-prints.

[4] Tiwari, Prayag & Qian, Jia & Li, Qiuchi & Wang, Benyou & Gupta,
Deepak & Khanna, Ashish & Rodrigues, Joel & Albuquerque, V.H.C.. (2018).
Detection of Subtype Blood Cells using Deep Learning. Cognitive Systems
Research. 52. 10.1016/j.cogsys.2018.08.022.
https://doi.org/10.1016/j.cogsys.2018.08.022

[5] Khamparia, Aditya & Singh, Aman & Anand, Divya & Gupta, Deepak &
Khanna, Ashish & Kumar, N Arun & Tan, Joseph. (2018). A novel deep
learning-based multi-model ensemble method for the prediction of neuromuscular
disorders. Neural Computing and Applications. 10.1007/s00521-018-3896-0.
https://doi.org/10.1007/s00521-018-3896-0

39
[6] Khamparia, Aditya & Gupta, Deepak & Nhu, Nguyen & Khanna, Ashish
& Pandey, Babita & Tiwari, Prayag. (2019). Sound Classification Using
Convolutional Neural Network and Tensor Deep Stacking Network. IEEE Access.
PP. 1-1. 10.1109/ACCESS.2018.2888882.
https://doi.org/10.1109/ACCESS.2018.2888882

[7] Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). Imagenet


classification with deep convolutional neural networks. In Advances in neural
information processing systems (pp. 1097-1105).

[8] Kim, Y. (2014). Convolutional neural networks for sentence classification.


arXiv preprint arXiv:1408.5882. https://doi.org/10.3115/v1/D14-1181

[9] Gatys, L. A., Ecker, A. S., & Bethge, M. (2016). Image style transfer using
convolutional neural networks. In Proceedings of the IEEE conference on
computer vision and pattern recognition (pp. 2414-2423).
https://doi.org/10.1109/CVPR.2016.265

[10] Jaderberg, M., Vedaldi, A., & Zisserman, A. (2014). Speeding up


convolutional neural networks with low rank expansions. arXiv preprint
arXiv:1405.3866. https://doi.org/10.5244/C.28.88

[11] LeCun, Y., Kavukcuoglu, K., & Farabet, C. (2010, May). Convolutional
networks and applications in vision. In Proceedings of 2010 IEEE International
Symposium on Circuits and Systems (pp. 253-256). IEEE.
https://doi.org/10.1109/ISCAS.2010.5537907

[12] Hinton, G. E., & Salakhutdinov, R. R. (2006). Reducing the dimensionality


of data with neural networks. science, 313(5786), 504-507.
https://doi.org/10.1126/science.1127647

40
[13] Baluja, Shumeet. "Hiding Images in Plain Sight: Deep Steganography."
NIPS (2017).

[14] Kingma, Diederik & Ba, Jimmy. (2014). Adam: A Method for Stochastic
Optimization. International Conference on Learning Representations.

[15] Kumar, Mohit & Agrawal, Akshat & Garg, Ankit. (2014). A Review on
Various Digital Image Encryption Techniques and Security Criteria. International
Journal of Computer Applications. 13. 10.5120/16854-6720.
https://doi.org/10.5120/16854-6720

[16] Kaur, Rajinder. (2013). Image Encryption Techniques: A Selected Review.


IOSR Journal of Computer Engineering. 9. 80-83. 10.9790/0661-0968083.
https://doi.org/10.9790/0661-0968083

[17] Srivastava, Abhinav. "A survey report on Different Techniques of Image


Encryption." (2012).

[18] Li, C. G., Han, Z. Z., & Zhang, H. R. (2002). Image encryption techniques:
A survey [j]. Journal of Computer Research and Development, 10(023), 15.

[19] Khan, M., & Shah, T. (2014). A literature review on image encryption
techniques. 3D Research, 5(4), 29. https://doi.org/10.1007/s13319-014-0029-0

[20] Geetha, P. & Vs, Jayanthi & A.N., Jayanthi. (2018). Optimal Visual
Cryptographic Scheme with multiple share creation for Multimedia Applications.
Computers & Security. 78. 10.1016/j.cose.2018.07.009.
https://doi.org/10.1016/j.cose.2018.07.009

[21] Ye, G. (2010). Image scrambling encryption algorithm of pixel bit based on
chaos map. Pattern Recognition Letters, 31(5), 347-354.
https://doi.org/10.1016/j.patrec.2009.11.008

41
[22] Amnesh Goel, Nidhi Chandra "A Technique for Image Encryption Based
On Explosive n*n Block displacement Followed By Inter-Pixel Displacement of
RGB Attribute of A Pixel" 2012 International Conference on Communication
Systems and Network Technologies, 11-13 May 2012, page: 884-888.
https://doi.org/10.1109/CSNT.2012.190

42

You might also like