You are on page 1of 88

CHAPTER 1

INTRODUCTION

1.1 Cryptography:

The earliest forms of information hiding can actually be considered to be highly


crude forms of private-key cryptography; the “key” in this case being the knowledge of
the method being employed (security through obscurity). Steganography books are filled
with examples of such methods used throughout history. Greek messengers had messages
tattooed into their shave head, concealing the message when their hair finally grew back.
Wax tables were scraped down to bare wood were a message was scratched. Once the
tablets were re-waxed, the hidden message was secure. Over time these primitive
cryptographic techniques improved, increasing speed, capacity and security of the
transmitted message.
Today, crypto-graphical techniques have reached a level of sophistication such
that properly encrypted communications can be assumed secure well beyond the useful
life of the information transmitted. In fact, it’s projected that the most powerful
algorithms using multi kilobit key lengths could not be comprised through brute force,
even if all the computing power worldwide for the next 20 years was focused on the
attack. Of course the possibility exists that vulnerabilities could be found, or computing
power breakthroughs could occur, but for most users in most applications, current
cryptographic techniques are generally sufficient.

Why then pursue the field of information hiding? Several good reasons exist, the
first being that “security through obscurity” isn’t necessarily a bad thing, provided that it
isn’t the only security mechanism employed. Steganography for instance allows us to
hide encrypted messages in mediums less likely to attract attention. A garble of random
characters being transmitted between two users may tip off a watchful 3rd party that
sensitive information is being transmitted; whereas baby pictures with some additional
noise present may not. The underlying information in the pictures is still encrypted, but
attracts far less attention being distributed in the picture then it would otherwise.

1
This becomes particularly important as the technological disparity between
individuals and organizations grows. Governments and businesses typically have access
to more powerful systems and better encryption algorithms then individuals. Hence, the
chance of individual’s messages being broken increases which each passing year.
Reducing the number of messages intercepted by the organizations as suspect will
certainly help to improve privacy.

Another advantage hinted at is that information hiding can fundamentally change


the way that we think about information security. Cryptographic techniques generally
rely on the metaphor of a piece of information being placed in a secure “box” and locked
with a “key”. The information itself is not disturbed and anyone with the proper key can
gain access. Once the box is open, all of the information security is lost. Compare this to
information hiding techniques where the key is embedded into he information itself.

Cryptography is the science of using mathematics to encrypt and decrypt data.


Cryptography enables you to store sensitive information or transmit it across insecure
networks (like the Internet) so that it cannot be read by anyone except the intended
recipient. While cryptography is the science of securing data, cryptanalysis is the science
of analyzing and breaking secure communication. Classical cryptanalysis involves an
interesting combination of analytical reasoning, application of mathematical tools, pattern
finding, patience, determination, and luck. Cryptanalysts are also called attackers.
Cryptology embraces both cryptography and cryptanalysis.

First we start with a few definitions. Cryptography can be defined as the


processing of information into an unintelligible (encrypted) form for the purposes of
secure transmission. Through the use of a “key” the receiver can decode the encrypted
message (decrypting) to retrieve the original message.

Stenography improves on this by hiding the fact that a communication even


occurred. The message m is imbedded into a harmless message c which is defined as the
cover-object. The message m is then embedded into c, generally with use of a key k that
is defined as the stego-key. The resulting message is then embedded into the cover-object
c, which results in stego-object s.

2
1.2 Steganography:

Steganography means to hide secret information into innocent data. Digital


images are ideal for hiding secret information. An image containing a secret message is
called a cover image. First, the difference of the cover image and the stego image should
be visually unnoticeable. The embedding itself should draw no extra attention to the stego
image so that no hackers would try to extract the hidden message illegally. Second, the
message hiding method should be reliable. It is impossible for someone to extract the
hidden message if she/he does not have a special extracting method and a proper secret
key. Third, the maximum length of the secret message that can be hidden should be as
long as possible.

“Steganography is the art of hiding information in ways that prevent the detection of
hidden messages,”

1.2.1 Steganography in History:


Steganography comes from Greek and means “covered writing”. The ancient
Greeks wrote text on wax-covered tablets. To pass a hidden message, a person would
scrape off the wax and write the message on the underlying wood. He/she would then
once again cover the wood with wax so it appeared unused. Many developments in
steganography occurred during World War II. This included the development of
invisible inks, microdots, and encoded messages.

1.2.2 Steganography in the Digital Age:


Steganography is the art of secret communication. Its purpose is to hide the very
presence of communication as opposed to cryptography whose goal is to make
communication unintelligible to those who do not possess the right keys. Digital images,
videos, sound files, and other computer files that contain perceptually irrelevant or
redundant information can be used as “covers” or carriers to hide secret messages. After
embedding a secret message into the cover-image, a so-called stego-image is obtained. It
is important that the stego-image does not contain any easily detectable artifacts due to
message embedding. A third party could use such artifacts as an indication that a secret

3
message is present. Once this message detection can be reliably achieved, the
steganographic tool becomes useless.

Obviously, the less information is embedded into the cover-image, the smaller the
probability of introducing detectable artifacts by the embedding process. Another
important factor is the choice of the cover-image. The selection is at the discretion of the
person who sends the message. The sender should avoid using cover-images that would
be easy to analyze for presence of secret messages. For example, one should not use
computer art, charts, images with large areas of uniform color, images with only a few
colors, and images with a unique semantic content, such as fonts. Although computer-
generated fractal images may seem as good covers6 because of their complexity and
irregularity, they are generated by strict deterministic rules that may be easily violated by
message embedding.

1.3 Cryptography VS Steganography:

Cryptography is the science of encrypting data in such a way that nobody can
understand the encrypted message, whereas in steganography the existence of data is
conceived means its presence cannot be noticed. The information to be hidden is
embedded into the cover object which can be text, image, audio or video so that the
appearance of cover object doesn’t vary even after the information is hidden.

Information to be hidden + cover object = stego object.

To add more security the data to be hidden is encrypted with a key before
embedding. To extract the hidden information one should have the key. A stego object is
one, which looks exactly same as cover object with hidden information.

1.4 Steganography VS Watermarking:

Watermarking is another branch of steganography it is mainly used to restrict the


piracy in digital media. In steganography the data to be hidden is not at all related to the
cover object, here our main intention is secret communication. In watermarking the data

4
to be hidden is related to the cover object it is extended data or attribute of the cover
object, here our main intention is to stop piracy of digital data. Steganography is a very
powerful tool because, as the stated above, it can be very difficult to detect.

1.5 Stegosystem:

The stegosystem is conceptually similar to the cryptosystem.

Figure 1.1 Basic block diagram of Stegosystem

Emb: The message to be embedded. It is anything that can be represented as a bit stream
(an image or text).

Cover: Data/Medium in which emb will be embedded.

Stego: Modified version of the cover that contains the embedded message,

Emb.key: Additional data that is needed for embedding & extracting.

fE: Steganographic function that has cover, emb & key as parameters.

5
Figure 1.2 Graphical version of the Stegosystem

Steganography refers to the science of “invisible” communication. Unlike


cryptography, where the goal is to secure communications from an eavesdropper,
steganographic techniques strive to hide the very presence of the message itself from an
observer. Although steganography is an ancient subject, the modern formulation of it is
often given in terms of the prisoner’s problem where Alice and Bob are two inmates who
wish to communicate in order to hatch an escape plan. However, all communication
between them is examined by the warden, Wendy, who will put them in solitary
confinement at the slightest suspicion of covert communication. Specifically, in the
general model for steganography, we have Alice wishing to send a secret message to
Bob. In order to do so, she” embeds” into a cover-object, to obtain the stego-object.

The stego-object is then sent through the public channel. The warden, Wendy,
who is free to examine all messages exchanged between Alice and Bob, can be passive or
active. A passive warden simply examines the message and tries to determine if it
potentially contains a hidden message. If it appears that it does, she then takes appropriate
action else she lets the message through without any action. An active warden, on the
other hand, can alter messages deliberately, even though she may not see any trace of a
hidden message, in order to foil any secret communication that can nevertheless be
occurring between Alice and Bob. The amount of change the warden is allowed to make

6
depends on the model being used and the cover objects being employed. For example,
with images, it would make sense that the warden is allowed to make changes as long as
she does not alter significantly the subjective visual quality of a suspected stego-image.

It should be noted that the main goal of steganography is to communicate securely


in a completely undetectable manner. That is, Wendy should not be able to distinguish in
any sense between cover-objects (objects not containing any secret message) and stego-
objects (objects containing a secret message). In this context, “steganalysis” refers to the
body of techniques that are designed to distinguish between cover-objects and stego-
objects. It should be noted that nothing might be gleaned about the contents of the secret
message. When the existence of hidden message is known, revealing its content is not
always necessary. Just disabling and rendering it useless will defeat the very purpose of
steganography. In this paper, we present a steganalysis technique for detecting stego-
images, i.e., still images containing hidden messages, using image quality metrics.

Although we focus on images, the general techniques we discuss would also be


applicable to audio and video media. Given the proliferation of digital images, and given
the high degree of redundancy present in a digital representation of an image (despite
compression), there has been an increased interest in using digital images as cover-
objects for the purpose of steganography. The simplest of such techniques essentially
embeds the message in a subset of the LSB (least significant bit) plane of the image,
possibly after encryption. It is well known that an image is generally not visually affected
when its least significant bit plane is changed. Popular steganographic tools based on
LSB like embedding vary in their approach for hiding information. For example
Steganos and Stools use LSB embedding in the spatial domain, while Jsteg embeds in the
frequency domain. Other more sophisticated techniques include the use of quantization
and dithering for a good survey of steganography techniques. What is common to these
techniques is that they assume a passive warden framework. That is they assume the
warden Wendy will not alter the image. We collectively refer to these techniques as
passive warden steganography techniques.

Conventional passive warden steganography techniques like LSB embedding are


not useful in the presence of an active warden as the warden can simply randomize the

7
LSB plane to thwart communication. In order to deal with an active warden Alice must
embed her message in a robust manner. That is, Bob should be able to accurately recover
the secret message despite operations like LSB randomizing, compression, filtering, and
rotation by small degrees, etc. performed by the active warden Wendy. Indeed, the
problem of embedding messages in a robust manner has been the subject of intense
research in the image processing community, albeit for applications other than
steganography, under the name of robust digital watermarking A robust digital watermark
is an imperceptible signal added to digital content that can be later detected or extracted n
order to make some assertion about the content. For example, the presence of her
watermark can be used by Alice to assert ownership of the content. Recent years have
seen an increasing interest in digital watermarking with many different applications,
ranging from copyright protection and digital rights management, to secret
communication.

Essentially robust digital watermarks provide a means of image-based


steganography in the presence of an active warden since modifications made by the
warden will not affect the embedded watermark as long as the visual appearance of the
image is not significantly degraded. However, despite this obvious and commonly
observed connection to steganography, there has been very little effort aimed at analyzing
or evaluating the effectiveness of common robust watermarking techniques for
steganographic applications. Instead, most work has focused on analyzing or evaluating
the watermarking algorithms for their robustness against various kinds of attacks that try
to remove or destroy them. However, if robust digital watermarks are to be used in active
warden steganography applications, detection of their presence by an unauthorized agent
defeats their very purpose. Even in applications that do not require hidden
communication, but only robustness, we note that it would be desirable to first detect the
possible presence of a watermark before trying to remove or manipulate it. This means
that a given signal would have to be first analyzed for the presence of a watermark. In
this project, we develop steganalysis techniques both for conventional LSB-like
embedding used in the context of a passive warden model and for watermarking which
can be used to embed secret messages in the context of an active warden. In order to
distinguish between these two models, we will be using the terms watermark and

8
message when the embedded signal is in the context of an active warden and a passive
warden, respectively.

Furthermore, we simply use the terms marking or embedding when the context of
discussion is general to include both active and passive warden steganography. The
techniques we present are novel and to the best of our knowledge, the first attempt at
designing general purpose tools for steganalysis. General detection techniques as applied
to steganography have not been devised and methods beyond visual inspection and
specific statistical tests for individual techniques like LSB embedding are not present in
the literature. Since too many images have to be inspected visually to sense hidden
messages, the development of a technique to automate the detection process will be very
valuable to the steganalyst. Our approach is based on the fact that hiding information in
digital media requires alterations of the signal properties that introduce some form of
degradation, no matter how small. These degradations can act as signatures that could be
used to reveal the existence of a hidden message. For example, in the context of digital
watermarking, the general underlying idea is to create a watermarked signal that is
perceptually identical but statistically different from the host signal. A decoder uses this
statistical difference in order to detect the watermark. However, the very same statistical
difference that is created could potentially be exploited to determine if a given image is
watermarked or not.

1.6 Statement of Problem:

The goals for this Project have been the following.

One goal has been to compile an introduction to the subject of steganography and
steganalysis. There exist a number of studies on various algorithms, but complete
treatments on a technical level are not as common. Material from papers, journals, and
conference proceedings are used that best describe the various parts.

Another goal has been to search for algorithms that can be used to implement for
the detection of steganographic techniques.

9
A third goal is to evaluate their performance of with different image quality
metrics. These properties were chosen because they have the greatest impact on the
detection of steganography algorithms

A final goal has been to design and implement the steganalysis detector in
MATLAB.

10
CHAPTER 2

WAVELET TRANSFORM

2.1 Overview:
Wavelets are mathematical functions defined over a finite interval and having an
average value of zero that transform data into different frequency components,
representing each component with a resolution matched to its scale.

The basic idea of the wavelet transform is to represent any arbitrary function as a
superposition of a set of such wavelets or basis functions. These basis functions or baby
wavelets are obtained from a single prototype wavelet called the mother wavelet, by
dilations or contractions (scaling) and translations (shifts). They have advantages over
traditional Fourier methods in analyzing physical situations where the signal contains
discontinuities and sharp spikes. Many new wavelet applications such as image
compression, turbulence, human vision, radar, and earthquake prediction are developed in
recent years. In wavelet transform the basis functions are wavelets. Wavelets tend to be
irregular and symmetric. All wavelet functions, w(2kt - m), are derived from a single
mother wavelet, w(t). This wavelet is a small wave or pulse like the one shown in Figure
2.1.

Normally it starts at time t = 0 and ends at t = T. The shifted wavelet w(t - m)


starts at t = m and ends at t = m + T. The scaled wavelets w(2kt) start at t = 0 and end at t
= T/2k. Their graphs are w(t) compressed by the factor of 2k as shown in Figure 2.2. For
example, when k = 1, the wavelet is shown in Figure 2.2(a). If k = 2 and 4, they are
shown in (b) and (c), respectively.

11
Figure 2.1 Mother wavelet w(t)

12
(a)w(2t) (b)w(4t) (c)w(8t)

Figure 2.2 Scaled wavelets

The wavelets are called orthogonal when their inner products are zero. The
smaller the scaling factor is, the wider the wavelet is. Wide wavelets are comparable to
low-frequency sinusoids and narrow wavelets are comparable to high-frequency
sinusoids.

2.2 Scaling:

Wavelet analysis produces a time-scale view of a signal. Scaling a wavelet simply


means stretching (or compressing) it. The scale factor is used to express the compression
of wavelets and often denoted by the letter a. The smaller the scale factor, the more

13
“compressed” the wavelet. The scale is inversely related to the frequency of the signal in
wavelet analysis.

2.3 Shifting:
Shifting a wavelet simply means delaying (or) hastening its onset.
Mathematically, delaying a function f(t) by k is represented by: f(t-k) and the schematic
is shown in Figure 2.3.

(a) Wavelet function Ψ (t) (b) Shifted wavelet function Ψ (t-k)

Figure 2.3 Shifting of Wavelets

2.4 Scale and Frequency:


The higher scales correspond to the most “stretched” wavelets. The more
stretched the wavelet, the longer the portion of the signal with which it is being
compared, and thus the coarser the signal features being measured by the wavelet
coefficients. The relation between the scale and the frequency is shown in Figure 2.4.

14
Low scale High scale

Figure 2.4 Scale and frequency of Wavelets

2.5 Discrete Wave Transform:

Calculating wavelet coefficients at every possible scale is a fair amount of work,


and it generates an awful lot of data. If the scales and positions are chosen based on
powers of two, the so-called dyadic scales and positions, then calculating wavelet
coefficients are efficient and just as accurate. This is obtained from discrete wavelet
transform (DWT).

2.5.1 One-Stage Filtering:


For many signals, the low-frequency content is the most important part. It is the
identity of the signal. The high-frequency content, on the other hand, imparts details to
the signal. In wavelet analysis, the approximations and details are obtained after filtering.
The approximations are the high-scale, low frequency components of the signal. The

15
details are the low-scale, high frequency components. The filtering process is
schematically represented as in Figure2.5.

Figure 2.5 Single stage filtering

The original signal, S, passes through two complementary filters and emerges as
two signals. Unfortunately, it may result in doubling of samples and hence to avoid this,
downsampling is introduced. The process on the right, which includes downsampling,
produces DWT coefficients. The schematic diagram with real signals inserted is as shown
in Figure 2.6.

16
Figure 2.6 Decomposition and decimation

2.5.2 Multiple-Level Decomposition:


The decomposition process can be iterated, with successive approximations being
decomposed in turn, so that one signal is broken down into many lower resolution
components. This is called the wavelet decomposition tree and is depicted as in Figure
2.7.

Figure 2.7 Multilevel decomposition

2.5.3 Wavelet Reconstruction:


The reconstruction of the image is achieved by the inverse discrete wavelet
transform (IDWT). The values are first upsampled and then passed to the filters. This is
represented as shown in Figure 2.8.

17
Figure 2.8 Wavelet Reconstruction

The wavelet analysis involves filtering and downsampling, whereas the wavelet
reconstruction process consists of upsampling and filtering. Upsampling is the process of
lengthening a signal component by inserting zeros between samples as shown in Figure
2.9.

Figure 2.9 Reconstruction using up sampling

18
2.5.4 Reconstructing Approximations and Details:

It is possible to reconstruct the original signal from the coefficients of the


approximations and details. The process yields a reconstructed approximation which has
the same length as the original signal and which is a real approximation of it.

The reconstructed details and approximations are true constituents of the original
signal. Since details and approximations are produced by downsampling and are only half
the length of the original signal they cannot be directly combined to reproduce the signal.
It is necessary to reconstruct the approximations and details before combining them. The
reconstructed signal is schematically represented as in Figure 2.10.

Figure 2.10 Reconstructed signal components

2.6 1-D Wavelet Transform:

The generic form for a one-dimensional (1-D) wavelet transform is shown in


Figure 2.11. Here a signal is passed through a low pass and high pass filter, h and g,
respectively, then down sampled by a factor of two, constituting one level of transform.

Figure 2.11 1-D Wavelet Decomposition

19
Repeating the filtering and decimation process on the lowpass branch outputs
make multiple levels or “scales” of the wavelet transform only. The process is typically
carried out for a finite number of levels K, and the resulting coefficients are called
wavelet coefficients.

The one-dimensional forward wavelet transform is defined by a pair of filters s


and t that are convolved with the data at either the even or odd locations. The filters s and
t used for the forward transform are called analysis filters.

nL nH

li = ∑ sjx2i+j and hi = ∑ tjx2i+1+j

j=-nl j=-nH

Although l and h are two separate output streams, together they have the same
total number of coefficients as the original data. The output stream l, which is commonly
referred to as the low-pass data may then have the identical process applied again
repeatedly. The other output stream, h (or high-pass data), generally remains untouched.
The inverse process expands the two separate low- and high-pass data streams by
inserting zeros between every other sample, convolves the resulting data streams with
two new synthesis filters s’ and t’, and adds them together to regenerate the original
double size data stream.

nH nl

yi = ∑ t’jl’i+j + ∑ s’j h’i+j where l’2i = li, l’ 2i+1 = 0

j= -nH j= -nH h’2i+1 = hi, h’2i = 0

To meet the definition of a wavelet transform, the analysis and synthesis filters s,
t, s’ and t’ must be chosen so that the inverse transform perfectly reconstructs the original

20
data. Since the wavelet transform maintains the same number of coefficients as the
original data, the transform itself does not provide any compression. However, the
structure provided by the transform and the expected values of the coefficients give a
form that is much more amenable to compression than the original data. Since the filters
s, t, s’ and t’ are chosen to be perfectly invertible, the wavelet transform itself is lossless.
Later application of the quantization step will cause some data loss and can be used to
control the degree of compression. The forward wavelet-based transform uses a 1-D sub-
band decomposition process; here a 1-D set of samples is converted into the low-pass
sub-band (Li) and high-pass sub-band (Hi). The low-pass sub-band represents a down
sampled low-resolution version of the original image. The high-pass sub-band represents
residual information of the original image, needed for the perfect reconstruction of the
original image from the low-pass sub-band

2.7 2-D Transform Hierarchy:

The 1-D wavelet transform can be extended to a two-dimensional (2-D) wavelet


transform using separable wavelet filters. With separable filters the 2-D transform can be
computed by applying a 1-D transform to all the rows of the input, and then repeating on
all of the columns.

LL1 HL1

LH1 HH1

Figure 2.12 Sub-band Labeling Scheme for a one level, 2-D Wavelet Transform

21
The original image of a one-level (K=1), 2-D wavelet transform, with
corresponding notation is shown in Figure 2.12. The example is repeated for a three-level
(K =3) wavelet expansion in Figure 2.13. In all of the discussion K represents the highest
level of the decomposition of the wavelet transform.

LL1 HL1
HL2
LH1 HH1
HL3

LH2 HH2

LH3 HH3

Figure 2.13 Sub-band labeling Scheme for a Three Level, 2-D Wavelet Transform

The 2-D sub-band decomposition is just an extension of 1-D sub-band


decomposition. The entire process is carried out by executing 1-D sub-band
decomposition twice, first in one direction (horizontal), then in the orthogonal (vertical)
direction. For example, the low-pass sub-bands (Li) resulting from the horizontal
direction is further decomposed in the vertical direction, leading to LLi and LHi sub-
bands.

Similarly, the high pass sub-band (Hi) is further decomposed into HLi and HHi.
After one level of transform, the image can be further decomposed by applying the 2-D
sub-band decomposition to the existing LLi sub-band. This iterative process results in
multiple “transform levels”. In Figure 2.13 the first level of transform results in LH 1,
HL1, and HH1, in addition to LL1, which is further decomposed into LH2, HL2, HH2, LL2
at the second level, and the information of LL2 is used for the third level transform. The

22
sub-band LLi is a low-resolution sub-band and high-pass sub-bands LHi, HLi, HHi are
horizontal, vertical, and diagonal sub-band respectively since they represent the
horizontal, vertical, and diagonal residual information of the original image. An example
of three-level decomposition into sub-bands of the image CASTLE is illustrated in Figure
2.14.

Figure 2.14 The process of 2-D wavelet transform applied through three transform levels

To obtain a two-dimensional wavelet transform, the one-dimensional transform is


applied first along the rows and then along the columns to produce four sub-bands: low-
resolution, horizontal, vertical, and diagonal. (The vertical sub-band is created by
applying a horizontal high-pass, which yields vertical edges.) At each level, the wavelet
transform can be reapplied to the low-resolution sub-band to further decorrelate the
23
image. Figure 2.14 illustrates the image decomposition, defining level and sub-band
conventions used in the AWIC algorithm. The final configuration contains a small low-
resolution sub-band. In addition to the various transform levels, the phrase level 0 is used
to refer to the original image data.

2.8 Wavelet Computation:

In order to obtain an efficient wavelet computation, it is important to eliminate as


many unnecessary computations as possible. A careful examination of the forward and
reverse transforms shows that about half the operations either lead to data which are
destroyed or are null operations (as in multiplication by 0).

The one-dimensional wavelet transform is computed by separately applying two


analysis filters at alternating even and odd locations. The inverse process first doubles the
length of each signal by inserting zeros in every other position, then applies the
appropriate synthesis filter to each signal and adds the filtered signals to get the final
reverse transform.

2.9 Algorithms and Transformations:

Another steganography method is to hide data in mathematical functions that are


in compression algorithms. Two functions are Discrete Cosine Transformation (DCT)
and Wavelet Transformation. The DCT and wavelet functions transform data from one
domain into another. The DCT function transforms that data from a spatial domain to a
frequency domain.

Figure 2.15 Discrete Cosine Transformation (DCT)

24
The DCT function:

. The idea behind it in regard to steganography is to hide the data bits in the least
significant coefficients.

2.10 To Encode the Hidden Data:

Figure 2.16 Graphical representation to encode the hidden data

• Take the DCT or wavelet transform of the cover image


• Find the coefficients below a certain threshold
• Replace these bits with bits to be hidden (can use LSB insertion)

25
• Take the inverse transform
• Store as regular image

2.11 To Decode the Hidden Data:

Figure 2.17 Graphical representation to encode the hidden data

• Take the transform of the modified image


• Find the coefficients below a certain threshold
• Extract bits of data from these coefficients
• Combine the bits into an actual message

26
CHAPTER 3

METHODS OF STEGANOGRAPHY

3.1 Adaptive Steganography Using Filtering:

Adaptive Steganography reduces modifications to the image, and adapts the


message embedding technique to the actual content and features of the image. In general,
to keep a good degree of stealth-ness, Adaptive methods embed message bits into certain
random clusters of pixels (avoiding areas of uniform color) selecting pixels with large
local standard deviation or image blocks containing a number of different colors. The
main advantage of adaptive steganography is that the changes made to the cover image
take into account the sensitivity of the human visual system and also various statistical
parameters generally being used by steg-analysis algorithms. The main challenge posed
to existing adaptive steganography techniques is that the methods so far developed
doesn't seem to have a way to control the amount of information that is to be hidden, for a
given cover image. This problem is overcome in the method presented in this paper.

The proposed approach utilizes the sensitivity of the human visual system to
adaptively modify the intensities of some pixels in a high frequency components spatial
image (HFSI) of the cover image. The modification of pixel intensities depends on the
magnitude of the pixels in HFSI and also on the local features of the cover image. If the
contrast of the image is large (e.g., an edge), the intensities can be changed greatly
without introducing any distortion to human eyes. On the other hand, if the contrast is
small (e.g. a smooth), the intensities can only be tuned slightly. In this method, first the
cover image is passed through a filter to separate the high and low frequency components
of the image. The inverse transform of both the images is computed. Now the pixels
values of HFSI are modified depending on the magnitude of the pixel i.e. more the
magnitude more the Least Significant Bits (LSB's) of that pixel are changed and also the
local features of cover image are considered. Now both the LFSI (Low Frequency

27
components spatial image of cover image) and HFSI are added to form the stego - image.
At the receiver the reverse process is to be done to recover the message.

There are four different methods of Steganography:

• Least Significant Bit Insertion in Transformation Domain


• Least Significant Bit Insertion in Spatial Domain
• Reversible Data Embedding using Difference Expansion
• Reversible Data Hiding

3.2 Introduction to LSB:

Maintaining the secrecy of digital information when being communicated over the
Internet is presently a challenge. Given the amount of cheap computation power available
and certain known limitations of the encryption methods it is not too difficult to launch
attacks on cipher-text. An ideal steganographic technique embeds message information
into a carrier image with virtually imperceptible modification of the image. Adaptive
steganography comes closer to this ideal since it exploits the natural variations in the
pixel intensities of a cover image to hide the secret message. The objective of
steganography is a method of embedding additional information into the digital contents
that is undetectable to listeners. We are investigating its embedding, detecting, and
coding techniques.

The idea behind the LSB algorithm is to insert the bits of the hidden message into
the least significant bits of the pixels. As the application domain of embedding data in
digital multimedia sources becomes broaden, several terms are used by various groups of
researchers, including steganography, digital watermarking, and data hiding. This paper
introduces a new, principled approach to detecting least significant bit (LSB)
steganography in digital signals such as images and audio. It is shown that the length of
hidden messages embedded in the least significant bits of signal samples can be estimated
with relatively high precision. The new steganalytic approach is based on some statistical
measures of sample pairs that are highly sensitive to LSB embedding operations. The

28
resulting detection algorithm is simple and fast. To evaluate the robustness of the
proposed steganalytic approach, bounds on estimation errors are developed. Furthermore,
the vulnerability of the new approach to possible attacks is also assessed, and counter
measures are suggested A detailed algorithm is presented along with results of its
application on some sample images.

3.3 Advantages of LSB Insertion:

A major advantage of the LSB algorithm is it is quick and easy. There has also
been steganography software developed which work around LSB color alterations via
palette manipulation. LSB insertion also works well with gray-scale images.

3.4 LSB Insertion in Transformation Domain:


The idea behind the LSB algorithm is to insert the bits of the hidden message into
the least significant bits of the pixels.

Simplified Example with a 24 bit pixel:

1 pixel:

(00100111 11101001 11001000)

Insert 101:

(00100111 11101000 11001001)

Red green blue

Simplified Example with an 8 bit pixel:

1 pixel:

(00 01 10 11)

White red green blue

Insert 0011:

29
(00 00 11 11)

white white blue blue

3.5 LSB Insertion in Spatial Domain:

Usually 24-bit or 8-bit files are used to store digital images. The former one
provides more space for information hiding however, it can be quite large. The colored
representations of the pixels are derived from three primary colors: red, green and blue.
24-bit images use 3 bytes for each pixel, where each primary color is represented by 1
byte. Using 24-bit images each pixel can represent 16,777,216 color values. We can use
the lower two bits of these color channels to hide data, then the maximum color change in
a pixel could be of 64-color values, but this causes so little change that is undetectable for
the human vision system. This simple method is known as Least Significant Bit insertion
Using this method it is possible to embed a significant amount of information with no
visible degradation of the cover image. Figure 3.11 shows the process.

Several versions of LSB insertion exist. It is possible to use a random number


generator initialized with a stego-key and its output is combined with the input data, and
this is embedded to a cover image. For example in the presence of an active warden it is
not enough to embed a message in a known place (or in a known sequence of bits)
because the warden is able to modify these bits, even if he can’t decide whether there is a
secret message or not, o r he can’t read it because it is encrypted. The usage of a stego-
key is important, because the security of a protection system should not be based on the
secrecy of the algorithm itself, instead of the choice of a secret key. Figure 3.2 shows this
process. The LSB inserting usually operates on bitmap images. ‘Steganos for Windows’
and ‘Wbstego’ are LSB inserting software products which are able to embed data (in
clear or encrypted format) in a bitmap image. The embedded data cannot be considered
as a watermark, because even if a small change occurs in a picture (cropping, lossy
compression, color degradation) the embedded information will be lost – although the
change which is occurred during the embedding process is invisible.

30
Figure 3.1 Graphical representation of LSB insertion

Figure 3.2 Stego Image formation through LSB insertion

31
3.5.1 Algorithm:

Step 1: Let the cover image is represented by c(x,y). It is then passed through a filter
with transfer function h(x,y) to separate high and low frequency components.

F[c(x, y)] = C(X, Y)

Where C(X, Y) represents Fourier Transform of the cover image. In this paper capital
letters representation for pixel is used for frequency domain and small letters for spatial
Representation.

C(X, Y)H(X, Y) = LO(X, Y) + HI(X, Y)

Where LO(X, Y), HI(X, Y) represent low frequency and high frequency components of
cover image respectively, obtained after passing through the filter with cut off as stated
above.

Step 2: Inverse transform of both the frequency components is found out, known as HFSI
(High Frequency components Spatial Image) and LFSI (Low Frequency components
Spatial Image) separately.

F1[LO(X, Y)]= lo(x, y) and F-1 [HI(X, Y)] = hi(x, y)

Where lo(xy) and hi(x,y) are the spatial components of low and high frequencies in the
cover image respectively.

Step 3: Now message is embedded into HFSI image. The number of bits modified in a
pixel is made to depend up on its magnitude and also on the local features of the cover
image. Let the message is represented as m(x,y) and the embedding function as M[].

mlo(x, y) = M[lo(x, y) + m(x, y)]

Step 4: Both the modified HFSI and unmodified LFSI are added to form stego - image.

Steg(x, y) = mlo(x, y) + lo(x, y)

Step5: At the receiver LFSI is subtracted from stego - image leaving modified HFSI
image.

32
mhi(x, y) = steg(x, y) - hi(x, y)

Step 6: Now the message is decoded from the Modified HTSI image using the stego –
key.

m(x, y) + lo(x, y) = M '[mhi(x, y)]

3.6 Reversible Data Embedding:

This type of reversible steganography directly modifies image pixels in the spatial
domain to achieve reversibility. Since this technique is easy to implement, offer a
relatively high hiding capacity, and the quality of the cover image can be easily
controlled, it has become a popular method for reversible steganography.

Reversible data embedding, which is also called lossless data embedding, embeds
invisible data (which is called a payload) into a digital image in a reversible fashion. As a
basic requirement, the quality degradation on the image after data embedding should be
low. An intriguing feature of reversible data embedding is the reversibility, that is, one
can remove the embedded data to restore the original image. From the information hiding
point of view, reversible data embedding hides some information in a digital image in
such a way that an authorized party could decode the hidden information and also restore
the image to its original, pristine state. The performance of a reversible data-embedding
algorithm can be measured by the following.

1) Payload capacity limit: what is the maximal amount of information can be embedded?

2) Visual quality: how is the visual quality on the embedded image?

3) Complexity: what is the algorithm complexity?

The motivation of reversible data embedding is distortion- free data embedding.


Though imperceptible, embedding some data will inevitably change the original content.
Even a very slight change in pixel values may not be desirable, especially in sensitive
imagery, such as military data and medical data. In such a scenario, every bit of
information is important. Any change will affect the intelligence of the image, and the
access to the original, raw data is always required. From the application point of view,
33
reversible data embedding can be used as an information carrier. Since the difference
between the embedded image and original image is almost imperceptible from human
eyes, reversible data embedding could be thought as a covert communication channel. By
embedding its message authentication code, reversible data embedding provides a true
self authentication scheme, without the use of metadata. In this paper, we present a high-
capacity, high visual quality, reversible data-embedding method for digital images.

Our method can be applied to digital audio and video as well. We calculate the
differences of neighboring pixel values, and select some difference values for the
difference expansion (DE). The original content restoration information, a message
authentication code, and additional data (which could be any data, such as date/time
information, auxiliary data, etc.) will all be embedded into the difference values. In this
paper we will consider grayscale images only. For color images, there are several options.
One can decorrelate the dependence among different color components by a reversible
color conversion transform, and then reversibly embed the data in the decorrelated
components. Or one can reversibly embed each color component individually. Please
note that reversible data embedding is a fragile technique When the embedded image is
manipulated and/or lossy compressed, the decoder will find out it is not authentic and
thus there will be no original content restoration.

3.7 Reversible Data Hiding:

Data Hiding is referred to as a process to hide data (representing some


information) into cover media. That is, the data hiding process links two sets of data, a set
of the embedded data and another set of the cover media data. The relationship between
these two sets of data characterizes different applications. For instance, in covert
communications, the hidden data may often be irrelevant to the cover media. In
authentication, however, the embedded data are closely related to the cover media. In
these two types of applications, invisibility of hidden data is an important requirement. In
most cases of data hiding, the cover media will experience some distortion due to data
hiding and cannot be inverted back to the original media. That is, some permanent
distortion has occurred to the cover media even after the hidden data have been extracted
out. In some applications, such as medical diagnosis and law enforcement, it is critical to
34
reverse the marked media back to the original cover media after the hidden data are
retrieved for some legal considerations.

In other applications, such as remote sensing and high-energy particle physical


experimental investigation, it is also desired that the original cover media can be
recovered because of the required high-precision nature. The marking techniques
satisfying this requirement are referred to as reversible, lossless, distortion-free, or
invertible data hiding techniques. Reversible data hiding facilitates immense possibility
of applications to link two sets of data in such a way that the cover media can be
losslessly recovered after the hidden data have been extracted out, thus providing an
additional avenue of handling two different sets of data.

Obviously, most of the existing data hiding techniques are not reversible. For
instance, the widely utilized spread-spectrum based data hiding methods are not
invertible owing to truncation (for the purpose to prevent over/underflow) error and
round-off error. The well-known least significant bit plane (LSB) based schemes and are
not lossless owing to bit replacement without “memory.” Another category of data
hiding techniques, quantization-index-modulation (QIM) based schemes and , are not
distortion-free owing to quantization error.

Recently, some reversible marking techniques have been reported in the literature.
The first method is carried out in the spatial domain. It uses modulo 256 addition
(assuming here that eight-bit grayscale images are considered) to embed the hash value of
the original image for authentication. The embedding formula is Iω =(I+W)mod(256), in
which I denotes the original image, Iω the marked image, and W = W(H(I),K) the
watermark, where H(I) denotes the hash function operated on the original image I, and K
the secret key. Because of using modulo 256 additions, the over/underflow is prevented
and the reversibility is achieved. Some annoying salt-and-pepper noise, however, is
generated owing to possible grayscale value flipping over between 0 and 255 in either
direction during the modulo 256 addition.

The second reversible marking technique was developed in the transform domain,
which is based on a lossless multi resolution transform and the idea of patchwork. It also

35
uses modulo 256 addition. Note that no experimental results about this technique have
been reported. Another spatial domain technique was reported in that losslessly
compresses some selected bit plane(s) to leave space for data embedding. Because the
necessary bookkeeping data are also embedded in the cover media as an overhead, the
method is reversible.

Since these techniques aim at authentication, the amount of hidden data is limited.
The capacity of method, which is based on the idea of patchwork and modulo 256
addition, is also limited except that the hidden data exhibit some robustness against high
quality JPEG compression. Since it uses modulo 256 addition, it also suffers from salt-
and-pepper noise. As a result, the technique cannot be utilized in many applications. This
observation is valid to all lossless data hiding algorithms that use modulo 256 addition to
achieve reversibility.

The first reversible marking technique that is suitable for a large amount of data
hiding was presented. This technique first segments an image into non-overlapping
blocks, and then introduces a discriminating function to classify these blocks into three
groups: R(egular), S(ingular), and U(nusable). It further introduces a flipping operation,
which can convert an R-block to an S-block and vice versa. A U-block remains intact
after the flipping operation. By assigning, say, binary 1 to an R-block and binary 0 to an
S-block, all R- and S-blocks are scanned in a chosen sequential order, resulting in a
biased (meaning that the binary numbers of 1 and 0 are not balanced) binary sequence.
This biased binary sequence is losslessly compressed to leave space for data embedding
and the compressed bit sequence is embedded into the cover media as an overhead for
later reconstruction of the original image. In data embedding, the R- and S-blocks are
scanned once again and the flipping operation is applied whenever necessary to make the
changed R- and S-block sequence coincident with the to-be-embedded data followed by
the overhead data mentioned above. While it is novel and successful in reversible data
hiding, the payload is still not large enough for some applications. Specifically, the
embedding capacity estimated by authors ranges from 3 to 41 kb for a 512 *512 *8 cover
grayscale image when the embedding amplitude is 4 (the estimated average PSNR of the
marked image versus the original image is 39 dB) .

36
Another problem with the method is that when the embedding strength increases
in order to increase the payload, the visual quality of the marked image will drop severely
due to annoying artifacts. To increase the payload dramatically, a new lossless data
hiding technique based on integer wavelet transform (IWT) (a second generation wavelet
transform, which has avoided round-off errors) was developed recently. Because of the
superior decorrelation capability of wavelet transform, the selected bit plane compression
of IWT coefficients in high frequency sub-bands creates more space for data hiding,
resulting in a two to five times payload as large. Specifically, its payload ranges from 15
to 94 kb for a 512 512 8 grayscale image at the same (39 dB) PSNR of the marked
images compared with the original images.

To achieve reversible data hiding, a histogram modification is applied in its pre-


processing to prevent over/underflow. This histogram modification causes, however, a
relatively low PSNR of the marked image versus the original image though there are no
annoying artifacts. It is noted that reversible data hiding has attracted increasing attention
recently, and more algorithms are being developed. Then the authors adopt the CALIC
lossless image compression algorithm, with the quantized values as side information, to
efficiently compress the quantization residuals to create high capacity for the payload
data.

The compressed residual and the payload data are concatenated and embedded
into the host signal via generalized-LSB modification method. The payload of this
technique is from 15 to 143 kb for a 512 512 8 grayscale image while the PSNR is
38 dB. Even though the payload is high, the PSNR is still not high enough. In this paper,
we propose a new reversible data embedding technique, which can embed a large amount
of data (5–80 kb for a 512 512 8 grayscale image) while keeping a very high visual
quality for all natural images, specifically, the PSNR of the marked image versus the
original image is guaranteed to be higher than 48 dB. It utilizes the zero or the minimum
point of the histogram (defined below) and slightly modifies the pixel

37
Figure 3.3 Histogram of an image

grayscale values to embed data. This technique can be applied to virtually all types of
images. Up to now, it has been successfully tested on different types of images, including
some commonly used images, medical images, texture images, aerial images, and all of
the 1096 images in CorelDraw database. The computation of our proposed technique is
quite simple and the execution time is rather short. Although the proposed lossless data
hiding technique is applied to still images, it is also applicable to videos which consist of
a sequence of images.

3.8 Drawbacks of Existing Techniques:

1. In LSB Technique only you are going to hide in least significant only. So, anyone can
easily retrieve the secret information.

2. Compressed domain reversible steganography often suffers from high computational


cost, low hiding capacity, and low stego-image quality.

3. After hiding the data in image by using LSB algorithm, if someone takes the Image
and compress the image means definitely lsb value will be change.

4. So we can’t get the original data what we hided.

38
CHAPTER 4

LOSSLESS STEGANOGRAPHY BASED ON AMBTC


COMPRESSION

4.1 Introduction:

Information hiding is a technique that inserts secret messages into a cover file, so
that the existence of the messages is not apparent. Research in information hiding has
tremendous increased during the past decade with commercial interests. Information
hiding techniques that are used today include watermarking and steganography. The
major concern of watermarking is to protect the ownership of a digital content, while
steganography is to embed secret messages into digital content so that the secret
messages are not detectable. All digital media, such as digital images, videos and audio
files, can be used to hide secret messages. However, digital images are often used for
steganography. This is because nature images usually have higher degree of redundancy,
which are suitable to embed information without degrading the visual quality of the
images. Moreover, images are widely used throughout the internet, which usually arouse
little suspicion than other digital media. Although many steganography techniques have
been developed for digital images, most of them are irreversible. That is, the original
image cannot be recovered to its original state after the extraction of the secret data.

At present, there is only a small amount of literature dealing with reversible data
hiding. However, most of them are focused on spatial domain; rare of them addressed the
reversibility on the compressed domain. In 2006, Chang and Lin proposed a reversible
data embedding mechanism for VQ compressed images.

They used side matching and relocation techniques to achieve reversibility


without using the location map. However, the computational cost for their method is
high, and is not suitable for real-time applications. In 2007, Chang et al. proposed a new
reversible data hiding technique in the VQ-compressed domain further, and the newly
proposed method has the benefit of high efficiency of the embedding and extraction

39
process. However, the quality of the stego-image depends largely on a specially designed
codebook, and distortions of the stego-image may become unacceptable if a poor
codebook is selected.

In this paper, we propose a new lossless steganography scheme that embeds secret
data into AMBCT-compressed images. AMBTC is a well known lossy, block based
compression scheme. Each image block is compressed by using two quantization levels
and one bit plane. Due to its low complexity, low computational cost, and easy to
implement, AMBTC has gained wide interest in its further development, including image
compression and steganography. In our scheme, we will take the advantage of the order
of two quantization levels to hide secret data and achieve reversibility.

4.2 Block Diagram:

AMBTC Embeddi Extractio


Cover Stego
Compres ng in n from
Image Image
sion Trio Stego

Secre Secre
t t

Data Data

Figure 4.1 Block diagram of Secret Communication using Steganography

4.3 AMBTC Compression Technique:

The concept of absolute moment block truncation coding (AMBTC) was


introduced by Lema and Mitchell in 1984, and the goal of AMBTC is to preserve the
mean and the first absolute central moment of image blocks. The AMBTC encoding and
decoding procedures are briefly described in the following. In the encoding procedure of
AMBTC, the original host image O is first partitioned into a set of non-overlapping

40
blocks of n× n pixels. These image blocks can be viewed as k-dimensional vectors, where
k = n× n. Each image block is then compressed by using two quantization levels ai and bi,
and one bit plane B. Let oi be image block i, oi1,oi2,oi3,….oik be the pixels of image block
i, the two quantization levels ai and bi of AMBTC for block i can be calculated as follow:

Here qi denotes the number of pixels having a value higher than or equal to the
block mean oi. Once the two quantization levels, i.e., lower mean ai and higher mean bi

have been obtained, the bit plane for image


block i can be constructed by investigating pixel values within block i. If a pixel value ij
o is greater or equal to the mean value ci, then bij is set to 1. Otherwise, bij is set to 0. Each
image block is encoded in the same manner to construct a sequence of compressed code
ai, bi, Bi, i =1, 2…..z, where z is the total number of blocks to be encoded. Hence the
output of AMBTC for each block includes two quantization levels a and b; and one bit
plane B which specifies the state, a or b, for each output pixel.

An example for AMBTC encoding procedures are shown in Figure 4.2.


Figure 4.2(a) shows an image block of 4× 4 pixels. To encode this block, the mean of this
block is calculate as o = 108. The value o is then taken as a threshold to generate a bit
plane B, as shown in Figure 4.2(b). Pixels with values higher than or equal to o have a
corresponding bit valued 1 stored in the bit plane. Otherwise, bit valued 0 is stored. Two
rounded quantization levels a = 84 and b = 132 can be calculated using Equations (1) and
(2).

Once the quantization levels and the bit plane have been calculated, the
compressed code of this image block comes out as a trio of [84,132, (1000 1100 1100

41
1110)] . All image blocks are encoded with the same manner, until all the blocks are
processed.

Figure 4.2 Example of AMBTC encoding and decoding procedures

To decode an AMBTC-compressed image, the decoder reconstructs image blocks


from the compressed code. To recover an image block, if a value i b in B is 0, then the
corresponding pixel is reconstructed by the quantization level a, Otherwise, reconstructed
by the quantization level b. By recovering pixels in all image blocks, the whole
compressed image can be reconstructed. Figure 4.2(c) shows an example of AMBTC
decoded image block using the trio [84,132, (1000 1100 1100 1110)].

4.4 Formation of Trio:

In this section, a lossless steganography for AMBTC-compressed images is


introduced. For convenience, we defined the notations used in this paper first. The
original host image O is a grayscale image. The AMBTC-compressed code for O is
denoted by C, and the reconstructed AMBTC compressed image is denoted by E.
Embedding is done by modifying C, and the result is an AMBTC compressed stego-code
C’. The receiver then uses the restoring process to obtain the AMBTC-compressed stego-
image E’.

42
The AMBTC compressed code C consists of a sequence of trios (two quantization
level a and b, and a bit plane B). Each trio (a, b, B) represents the compressed code for an
image block. Note that if we interchange two quantization levels a and b, and perform
Logical NOT operation on the bit plane B, the reconstructed AMBTC image blocks will
remain the same. Let R() denotes the reconstruction function for AMBTC compressed
image blocks with 3 parameters a, b and B, then the following equation always hold true
for every trio (a, b, B) :

R(a,b, B) ≡ R(b,a, )

where B is the resultant of the Logical NOT operation on the bit plane B. Equation
3 implies that the reconstructed image E and the recovered stego-image E’ are exactly the
same, i.e. E ≡ E′ .

Since the interchange of the quantization levels together with logical NOT
operation on bit the plane B does not change the value of decoded image blocks, we may
adopt this property to embedded one bit into each trio without losing any image quality.
The embedding procedures are described in the following section.

4.5 Data embedding:

The process of producing a stego-image is described below. Suppose an AMBTC


compressed code C, to be embedded, is composed of N × N trios. The embedding
algorithm of the proposed method follows the steps listed below:

Step 1. The m-bits secret data S ( m ≤ N × N ) is first appended by 0’s of size N × N − m ,


and then XORed with a random binary sequence generated by a secret key k . The
encrypted bit stream is denoted by

Step 2. Sequentially embed secret data into AMBTC encoded blocks. For each AMBTC

encoded block I with trio , if the corresponding embedded bit ei =1 , then the

43
trio is changed to . Otherwise, leave the trio remain
unchanged.

Step 3. Repeat step 1 and step 2 until the entire encrypted bit stream E is embedded.

4.6 Data extraction:

The data extraction procedures are similar to that of the embedding procedures.
For each AMBTC compressed block i, if i i a < b, then the embedded secret bit ei =0 is
extracted. Otherwise, ei =1 is extracted. This procedure is repeated until all the encrypted
secret data Ebs have been extracted, and then decrypted using the secret key k to obtain
the original secret data S.

4.7 Quality Measurements:

The peak signal to noise ratio (PSNR) is used to measure the distortion between the
original image and the stego image. The computation of PSNR is defined as

Here ij x denotes the original pixel value, and x ij denotes the processed pixel value. To
investigate the performance of our scheme, we compare the stegoimage quality,
recovered image quality.

44
CHAPTER 5

DATA FLOW DIAGRAM

5.1 Flow Chart:

Selection of
Cover Image

Block
Sender (User) Separation

Trio
Formation

Secret Data Embedding

Stego Image
Formation
45
Figure 5.1 Formation of a stego image

Receiving of
Stego Image

Block
Sender (User) Separation

Trio
Formation

Secret Data Extraction

Original
Image

46
Figure 5.2 Extraction of a stego image

CHAPTER 6

MATLAB

6.1 Introduction:

The past decade has been a tremendous escalation in the use of computers. There
is a wealth of software packages available for analysis, design and manufacture of
devices, equipment, machinery and systems. There is no doubt that we have familiar with
computing techniques and have an awareness of these software packages. MATLAB is
such a software package that serves a vehicle for analysis and performance of a system.

MATLAB is a software package for high performance numeric computation and


data visualization. Fundamentally, it is built upon a foundation of sophisticated matrix
software for analyzing linear system of equations.

6.2 Features:

• A very strong programming environment, which is reasonably interactive.


• A high level matrix language with control flow statements, functions, data
structures, I/O, OOP features.
• Good plotting features and graphics handling techniques (3D) used for image
processing, animation and in visual interfacing.
• Rich of libraries such a as Application Program that interface (API) that allows
you to write C and FORTRAN Programs that interact with MATLAB.
• Rich of computational algorithms for simple functions like sum, since to complex
functions like FET, Bessel’s function etc.

47
• There are several ‘Tool boxes’ available for users of MATLAB. These tool boxes
are collections of functions written for special applications such as statistics,
communications, and control system design, signal processing and neural
networks.
MATLAB Includes Tools For:

1. Data acquisition.
2. Data analysis and Exploration.
3. Visualization and Image Processing.
4. Algorithm Programming and Development.
5. Modeling and simulation.
6. Programming and Application Development.

These tools allow you to solve the problems in Applied Maths, Physics,
Chemistry, Engineering and Finance – almost any application area that deals with
complex numerical calculations.

When MATLAB is invoked the following windows are present:-

• Command Window: This is the main window characterized by the prompt ‘>>’.
• All commands, including those for running user written programs are typed here.
• Command history: All commands typed on MATLAB prompt in command
window get recorded, even across multiple sessions.
• Workspace: It lists all variable that have been generated so far and shows there
type and size.
• Edit Window: This where we write, edit, create and save our own programs in
files called ‘M-Files’.
MATLAB for Speech Recognition:

For implementing a speech recognition algorithm, MATLAB is a good choice.


For our application we use the following tool boxes:

1. Signal processing tool box.

48
2. Symbolic math tool box.
3. General MATLAB instructions.

Signal Processing Toolbox:

The signal processing tool box is a specialized collection of M-files built


specifically for signal processing operations, from wave form generation to filter design
and implementation, parametric modeling, and spectral analysis.

The Toolbox provides 2 categories of tools:

Command Line Functions:

1. Analog and Digital filter analysis.


2. Digital filter implementation.
3. FIR and IIR digital filter design.
4. Analog filter design.
5. Filter Discretisation.
6. Spectral Windows transform.
7. Spectral analysis.
8. Statistical signal processing and Spectral analysis.
9. Parametric Modeling.
10. Linear prediction.
11. Waveform Generation.
Interactive Graphical User Interfaces for:

1. Filter design and analysis-FDA tool.


2. Filter visualization.
3. Signal plotting and analysis-WIN tool.
4. Window visualization.

49
5. Signal plotting and analysis, Spectral analysis and filtering signals-SP tool.

6.3 Symbolic MATH Toolbox:

The symbolic math tool box integrates powerful symbolic and variable precision
computing into MATLAB environment. This tool box supplement MATLAB numeric
and graphic facilities with several other types of mathematical computation.

6.4 Image Matrix:


MATLAB handles images as matrices. This involves breaking each pixel
of an image down into the elements of a matrix. MATLAB distinguishes between
color and grayscale images and therefore their resulting image matrices differ
slightly.

6.5 Introduction to Programming in MATLAB:

In this worksheet we will continue to learn Matlab programming. The main goal is
that you by completing the worksheet can write your own Runge Kutta 4 ODE-
solver. The worksheet centers around a few examples, and it is important to
implement these examples, run them and carefully compare the output with the code.
The prerequisites for this worksheets are the worksheets Introduction to Matlab and
Introduction to programming in Matlab.

6.6 Functions in MAT LAB:

You have already encountered functions that are built in to Matlab. The sin() is a
function that takes an argument and returns an output. As you start to write your own
programs in Matlab you will need to create your own functions that takes one or more
arguments and does something with these arguments.

Example:

Function y = function name(arguments list)

50
commands

The code above must be written in a separate m-file! The name of the file should coincide
with the name of the function. Remember to save the file with a .m after the file name.

6.7 Source Code:

function varargout = gui(varargin)

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @gui_OpeningFcn, ...

'gui_OutputFcn', @gui_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin & isstr(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

51
gui_mainfcn(gui_State, varargin{:});

end

function gui_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

a=ones(256,256);

axes(handles.axes1);

imshow(a);

axes(handles.axes2);

imshow(a);

axes(handles.axes3);

imshow(a);

function varargout = gui_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function browse_Callback(hObject, eventdata, handles)

[filename, pathname] = uigetfile('*.bmp;*.png;*.jpg', 'Pick an Image');

if isequal(filename,0) | isequal(pathname,0)

warndlg('User pressed cancel')

else

a=imread(filename);

[r c p]=size(a);

52
if p==3

a=rgb2gray(a);

end

axes(handles.axes1);

imshow(a);

handles.input=a;

guidata(hObject, handles);

end

function encoding_Callback(hObject, eventdata, handles)

input=handles.input;

input=double(input);

[row col] = size(input);

len=row*col;

block=0;

Q1={};

Q2={};

z=1;

pop=get(handles.popupmenu1,'value');

switch pop

case 1

k=16;

53
case 2

k=64;

end

mid=sqrt(k);

handles.blokval=k;

bit=zeros(1,len);

bitcount=1;

for x=1:mid:row

for y=1:mid:col

count=0;

t=0;

s=0;

a = input(x:x+(mid-1),y:y+(mid-1));

block=block+1;

m=mean(mean(a));

m=round(m);

for i=1:mid

for j=1:mid

if a(i,j)>=m

bit(1,bitcount)=1;

bitcount=bitcount+1;

54
count=count+1;

p=a(i,j);

s=s+p;

else

bit(1,bitcount)=0;

bitcount=bitcount+1;

c=a(i,j);

t=t+c;

end

end

end

q1=floor(inv((k-count)) *t);

Q1{z}=q1;

q2=floor(inv((count))*s);

Q2{z}=q2;

z=z+1;

clear a;

end

end

lev=size(Q2);

levv=lev(2)*(k+2);

55
tt=1;

zz=1;

ww=1;

trio=zeros(1,levv);

while(zz<=lev(2))

trio(1,tt)=Q1{zz};

tt=tt+1;

trio(1,tt)=Q2{zz};

tt=tt+1;

for kk=1:k

trio(1,tt)=bit(1,ww);

tt=tt+1;

ww=ww+1;

end

zz=zz+1;

end

bitcount=bitcount-1;

save bit bit;

save bitcount bitcount;

save Q1 Q1;

save Q2 Q2;

56
save row row;

save col col;

save block;

save trio trio;

warndlg('Encoding completed');

guidata(hObject, handles);

function embedd_Callback(hObject, eventdata, handles)

load bit;

load q1;

load q2;

load count;

load row;

load col;

load block;

bit1=reshape(bit,[row,col]);

N=sqrt(block);

load trio;

trionew=trio;

Input=bit1;

original=Input;

target=Input;

57
fid = fopen('message.txt','r');

F = fread(fid);

s = char(F');

fclose(fid);

len=length(F);

handles.lend=len;

sz1=size(Input);

segblock=sz1(1)/N;

size1=sz1(1)*sz1(2);

sz2=size(F);

size2=sz2(1);

if (len*8)<=(N*N)

val=(N*N)-(len*8);

j=1;

for i=1:len

k=8 ;

while(k>=1)

x(1,j)=bitget(F(i),k);

k=k-1;

j=j+1;

end

58
end

for v=(len*8)+1:N*N

x(1,v)=0;

end

Mc=size(sz1,1);

Nc=size(sz1,2);

Mm=size(sz2,1);

Nm=size(sz2,2);

message_vector=round(F./256);

rand('state',34);

for (kk=1:100)

pn_sequence_h=round(rand(sz1/segblock,sz1/segblock));

end

size1=N*N;

sequence=reshape(abs(pn_sequence_h),[1,size1]);

for z=1:size1

xored(1,z)=xor(x(z),sequence(z));

end

mm=1;

gg=1;

segblock1=segblock^2;

59
for z=1:size1

if xored(1,z)==1

a = not(bit(gg:gg+(segblock1-1)));

trionew(mm:mm+(segblock1+1))=[Q2{z} Q1{z} a];

end

mm=mm+(segblock1+2);

gg = gg +segblock1;

end

embedtrio=trionew;

kn=segblock1;

k1n=sqrt(kn);

blocksn=[];

[r c]=size(embedtrio);

len=r*c;

pp=1;

saf=1;

sa=k1n;

sbf=1;

sb=k1n;

while(pp<=len)

a=embedtrio(pp);

60
pp=pp+1;

b=embedtrio(pp);

pp=pp+1;

mn=1;

kj=1;

for jj=1:kn

if kj>k1n

mn=mn+1;

kj=1;

end

if embedtrio(pp)==0

output1(mn,kj)=a;

pp=pp+1;

kj=kj+1;

else

output1(mn,kj)=b;

pp=pp+1;

kj=kj+1;

end

end

blocksn(saf:sa,sbf:sb)=output1;

61
sbf=sb+1;

sb=sbf+(k1n-1);

if sb>row

saf=sa+1;

sa=saf+(k1n-1);

sbf=1;

sb=k1n;

end

end

axes(handles.axes2);

imshow(uint8(blocksn));

handles.out=blocksn;

guidata(hObject, handles);

save trionew trionew;

save sequence sequence;

save xored xored;

warndlg('Embedding completed');

else

warndlg('The secret data size is greater than Cover Image-Reduce the data');

end

function extraction_Callback(hObject, eventdata, handles)

62
load trionew;

load Q1;

load Q2;

load sequence;

load xored;

load row;

load col;

len=handles.lend;

[r c] = size(trionew);

wid = r*c;

blok=handles.blokval;

e=1;

for y=1:(blok+2):wid-(blok+1)

if trionew(1,y)<trionew(1,y+1)

xr(e)=0;

else

xr(e)=1;

end

e=e+1;

end

i=1;

63
gg=1;

mm=1;

rand('state',34);

blok1=sqrt(blok);

for (kk=1:100)

pn_sequence_h=round(rand(row/blok1,row/blok1));

end

tot=row/blok1;

size1=tot*tot;

sequence=reshape(abs(pn_sequence_h),[1,size1]);

for i=1:size1

if (isequal(sequence(i),0) & isequal(xr(i),0)) | (isequal(sequence(i),1) &


isequal(xr(i),1))

x(i)=0;

else

x(i)=1;

end

end

len2=len*8;

siz=size(x);

secret=x(1:len2);

64
place = [128 64 32 16 8 4 2 1];

cc=1;

asc=[];

for se=1:8:len2

binary=secret(cc:cc+7);

uu=(place(1).*binary(1))+(place(2).*binary(2))+(place(3).*binary(3))+
(place(4).*binary(4))+(place(5).*binary(5))+(place(6).*binary(6))+(place(7).*binary(7))+
(place(8).*binary(8));

if (exist('Output.txt'))

delete 'Output.txt';

end

fid = fopen('Output.txt','a');

fwrite(fid,char(uu),'char');

cc=cc+8;

end

fclose(fid);

warndlg('Text is retreived in output text file');

function decoding_Callback(hObject, eventdata, handles)

output=zeros(1,65536);

load trionew;

load row;

k=handles.blokval

65
k1=sqrt(k);

blocks=[];

[r c]=size(trionew);

len=r*c;

pp=1;

saf=1;

sa=k1;

sbf=1;

sb=k1;

while(pp<=len)

a=trionew(pp);

pp=pp+1;

b=trionew(pp);

pp=pp+1;

mn=1;

kj=1;

for jj=1:k

if kj>k1

mn=mn+1;

kj=1;

end

66
if trionew(pp)==0

output1(mn,kj)=a;

pp=pp+1;

kj=kj+1;

else

output1(mn,kj)=b;

pp=pp+1;

kj=kj+1;

end

end

blocks(saf:sa,sbf:sb)=output1;

sbf=sb+1;

sb=sbf+(k1-1);

if sb>row

saf=sa+1;

sa=saf+(k1-1);

sbf=1;

sb=k1;

end

end

axes(handles.axes3);

67
imshow(blocks,[]);

handles.out=blocks;

warndlg('Decoding Completed');

guidata(hObject, handles);

function validate_Callback(hObject, eventdata, handles)

reconstruct=handles.out;

input=handles.input;

reconstruct=double(reconstruct);

input=double(input);

[M N]=size(input);

MSE = sum(sum((input-reconstruct).^2))/(M*N);

PSNR = 10*log10(255*255/MSE);

PSNR=num2str(PSNR);

set(handles.psnr1,'String',PSNR);

set(handles.mse1,'String',MSE);

function psnr1_Callback(hObject, eventdata, handles)

function psnr1_CreateFcn(hObject, eventdata, handles)

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

68
end

function mse1_Callback(hObject, eventdata, handles)

function mse1_CreateFcn(hObject, eventdata, handles)

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

function clear_Callback(hObject, eventdata, handles)

delete('Output.txt');

a=ones(256,256);

axes(handles.axes1);

imshow(a);

axes(handles.axes2);

imshow(a);

axes(handles.axes3);

imshow(a);

set(handles.psnr1,'String',' ');

set(handles.mse1,'String',' ');

warndlg('Files erased succesfully');

function close_Callback(hObject, eventdata, handles)

69
close gui;

function popupmenu1_Callback(hObject, eventdata, handles)

function popupmenu1_CreateFcn(hObject, eventdata, handles)

if ispc

set(hObject,'BackgroundColor','white');

else

set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));

end

70
CHAPTER 7

RESULTS AND CONCLUSION

71
7.1 Results:

72
Figure 7.1 New command window of MATLAB

73
Figure 7.2 Source code of our gui file

74
Figure 7.3 GUI window in the MATLAB

75
Figure 7.4 Message file which we are embedding

76
Figure 7.5 Selection of image for covering

77
Figure 7.6 Selected image shown in GUI

78
Figure 7.7 Completion of Decoding Process

79
Figure 7.8 Completion of Embedding Process

80
Figure 7.9 Text file extracted in file named output

81
Figure 7.10 Extracted output file

82
Figure 7.11 Completion of Decoding Process

83
Figure 7.12 Retrieving of Original Image

84
Figure 7.13 File erased successfully

85
7.2 Conclusion:

Steganography can be used for hidden communication. We have explored the


limits of steganography theory and practice. We pointed out the enhancement of the
image steganographic system using LSB approach to provide a means of secure
communication. A stego-key has been applied to the system during embedment of the
message into the cover-image. In our proposed approach, the message bits are embedded
randomly into the cover-image pixels instead of sequentially. Finally, we have shown that
steganography that uses a key has a better security than non-key steganography. This is
so because without the knowledge of the valid key, it is difficult for a third party or
malicious people to recover the embedded message. However there are still some issues
need to be tackled to implement LSB on a digital image as a cover-object using random
pixels. After testing the system and studied the recorded results from the experiments.
We recommend using this proposed system in hiding secure information in any digital
system, because this system collect the properties of both steganography and
cryptography sciences.

7.3 Future Scope:

The steganography method presented here can also be combined with some
cryptography method to keep the data non-decipherable even if it is detected. The reserve
bytes in the header could also be used to encode a password or a key, which would have
to be matched to decode the rest of the data. In this method we can only use a square
image it can also be changed to any type of image. In addition to being vulnerable to
detection techniques, LSB is extremely vulnerable to corruption. That is, the integrity of
the hidden message can easily be destroyed. All the attacker must do is to randomize the
LSBs of the image. The attacker may not even know that it is a stego-image, but such
actions would destroy the secret message. Let us hope to overcome these disadvantages
in near future.

86
REFERENCES

1. Digital Image Processing Second Edition Rafael C. Gonzalez University of


Tennessee Richard E. Woods MedData Interactive Prentice Hall, 2001.

2. Anderson R. J., 'Stretching the Limits of Steganography', 1st Information Hiding


Workshop, Springer Lecture Notes in Computer Science, Vol.1174, pp. 39–48,
1996.

3. Provos, N., Honeyman, P., 'Hide and seek: an introduction to steganography',


Security & Privacy Magazine, IEEE, Vol. 1, No. 3, pp. 32-44, May-June 2003.

4. Fridrich, J., Goljan, M., Du, R., ‘Detecting LSB steganography in color and gray-
scale images’, IEEE Multimedia Special Issue on Security, pp. 22-28, October-
November 2001.

5. Dumitrescu, S., Wu, X., Memon, N., 'On steganalysis of random lsb embedding in
continuoustone images', IEEE International Conference on Image Processing,
Rochester, New York, September 2002.

6. Chandramouli, R. and N. Memon, 2001. Analysis of LSB based image


steganography techniques. Proceedings of the International Conference on Image
Processing, Oct. 7-10, IEEE Computer

7. Society, Washington DC., USA., pp: 1019-1022. DOI:


10.1109/ICIP.2001.958299

8. Judge, J.C., 2001. Steganography: Past, present, future


http://www.sans.org/reading_room/whitepapers/steganography/steganography_pa
st_present_future_552

9. Johnson, N.F., 2000. Steganography. http://www.jjtc.com/stegdoc/index2.html

10. Anderson, R., R. Needham and A. Shamir, 1998. The steganographic file system.
Lecture Notes Comput. Sci., 1525: 73-82.
http://www.springerlink.com/content/jmw3k974qybrqd20

87
88

You might also like