Professional Documents
Culture Documents
Zee's Project
Zee's Project
INTRODUCTION
1.1 CRYPTOGRAPHY
1
Fig 1.1. Cryptography as a flow model.
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.
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
3
Fig 1.2. Stegonography as a flow model.
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.
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.
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.
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.
The human nervous system can be broken down into three stages that may be
represented as follows:
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:
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.
8
fig 1.4. Schematic diagram of a Biological Neuron
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.
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.
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.
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.
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
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.
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.
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.
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.
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
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:
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
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.
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:
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.
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
26
helping with routine tasks. Model was developed using libraries including
Tensorflow, Keras, Matplotlib, Numpy, etc
3.6 DESIGN
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
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
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.
def rand_img(size):
return np.random.randint(0, 256, size) / 255.0
@\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.
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.
33
The following code is the Keras implementation of the model:
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:
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_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:
HELLO WORLD
which is exactly the same as the input. The images (with and without embedded
message) are:
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.
38
REFERENCES
[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
[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
[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
[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
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
[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