You are on page 1of 83

Image and Audio Steganography

SUBMITTED BY

[Student Name]

[Seat No.]

DATE OF SUBMISSION

[If a revised proposal is submitted, the date should be changed accordingly]

Under the guidance of Lionel Faleiro

Submitted in partial fulfillment of the requirements for qualifying M.C.A Semester VI


Examination
INSTITUTE OF DISTANCE AND OPEN

LEARNING UNIVERSITY OF MUMBAI

DR. SHANKAR DAYAL SHRAMA BHAVAN,

VIDYANAGARI, SANTACRUZ(E), MUMBAI-

98
INSTITUTE OF DISTANCE AND OPEN LEARNING

UNIVERSITY OF MUMBAI, IDE BUILDING,


VIDYANAGARI, MUMBAI-98

PROJECT CERTIFICATE

This is to certify that the Project titled


by Mr./Ms.

Seat No in partial fulfillment for M.C.A Degree Examination in


Semester VI for the academic year 2014-2015 has been found satisfactory. This report had
not been submitted for any other examination and does not form part of any other course
undergone by the candidate.

Signature Signature
Signature
Faculty in Charge External Examiner Coordinator – M.C.A
(IDOL)
Guided By Examined By Certified By

Acknowledgement

It has indeed been a great privilege for me to have Mr. Lionel Faleiro, Department of
Computer Science, I.D.O.L., University of Mumbai, as my mentor for this project.
His guidance and constant encouragement are the motive force behind this project work. I
take this opportunity to express my utmost gratitude to him. I am also indebted to him for
his timely and valuable advice.
Synopsis

on

Image and Audio Steganography

Submitted for partial fulfillment of award of

MCA Semester VI Examination

Statement about the Problem

Steganography is the practice of hiding private or sensitive information within something that
appears to be nothing out to the usual. Steganography is often
confused with cryptology because the two are similar in the way that they both are used to
protect important information. The difference between two is that steganography involves
hiding information so it appears that no information is hidden at all. If a person or persons
views the object that the information is hidden inside of he or she will have no idea that there
is any hidden information, therefore the person will not attempt to decrypt the information.

What steganography essentially does is exploit human perception, human senses are not
trained to look for files that have information inside of them, although this software is
available that can do what is called Steganography. The most common use of steganography is
to hide a file inside another file.

Why is the particular topic is chosen?

Through out history Steganography has been used to secretly communicate information
between people.

Some examples of use of Steganography is past times are:

1. During World War 2 invisible ink was used to write information on pieces of paper
so that the paper appeared to the average person as just being blank pieces of
paper. Liquids such as milk, vinegar and fruit juices were used, because when each
one of these substances are heated they darken and become visible to the human
eye.

2. In Ancient Greece they used to select messengers and shave their head, they would
then write a message on their head. Once the message had been written the hair was
allowed to grow back. After the hair grew back the messenger was sent to deliver the
message, the recipient would shave off the messengers hair to see the secrete message.
Now in today’s electronic world the message is sent over E media. So there should be
a necessity of new steganography technique which will defend against interception
attack.

Why This Steganography?

This technique is chosen, because this system includes not only imperceptibility but also un-
delectability by any steganolysis tool.

Objective:-

• Requirement of this steganography system is that the hider message carried by stego-
media should not be sensible to human beings.

• The other goal of steganography is to avoid drawing suspicion to the existence of a


hidden message.

This approach of information hiding technique has recently become important in a number of
application areas

Project Scope:

• The scope of the project is to limit unauthorized access and provide better security
during message transmission. To meet the requirements, I use the simple and
basic approach of steganography.

• In this project, the proposed approach finds the suitable algorithm for embedding the
data in an image / audio using steganography which provides the better security
pattern for sending messages through a network.

Methodology:
User needs to run the application. The user has two tab options – encrypt and decrypt. If user
select encrypt, application give the screen to select image file, information file and option to
save the image file. If user select decrypt, application gives the screen to select only image file
and ask path where user want to save the secrete file.

This project has two methods – Encrypt and Decrypt.

In encryption the secrete information is hiding in with any type of image file.Decryption is
getting the secrete information from image file. We will make use of LSB algorithm for this
process.

LSB Algorithm:

• LSB (Least Significant Bit) substitution is the process of adjusting the least
significant bit pixels of the carrier image.

• It is a simple approach for embedding message into the image.

• The Least Significant Bit insertion varies according to number of bits in an


image.

• For an 8 bit image, the least significant bit i.e., the 8th bit of each byte of the image
is changed to the bit of secret message.

• For 24 bit image, the colors of each component like RGB (red, green and blue) are
changed.

• LSB is effective in using BMP images since the compression in BMP is


lossless

For digital audio files the techniques are:

a. LSB Coding
b. Phase Coding
c. Parity Coding
d. Spread Sprectrum
Encryption Process

IMAGE FILE INFORMATION FILE

BMP FILE
Decryption Process

BMP FILE

INFORMATION FILE IMAGE FILE

Limitations of the Software:

This project has an assumption that is both the sender and receiver must have shared some
secret information before imprisonment. Pure steganography means that there is none prior
information shared by two communication parties.

What contribution would this Project make?


• In the present world, the data transfers using internet is rapidly growing because it is
so easier as well as faster to transfer the data to destination. So, many individuals and
business people use to transfer business documents, important information using
internet.

• Security is an important issue while transferring the data using internet because any
unauthorized individual can hack the data and make it useless or obtain information un-
intended to him.

Software Environment
 Operating System : Window XP
 Development Environment : MS Visual Studio .Net Framework 4.5
 Languages : C#.Net

Hardware Environment
 Processor : Intel® Core™ i3-4005U CPU
@ 1.70 GHz
 RAM : 8 GB
 Hard Disk : 250 GB
 Mother Board : Intel chipset board
 Mouse : Logitech optical mouse

 Key Board : 104 keys keyboard

Conclusion:-
Steganography is a really interesting subject and outside of the mainstream cryptography and
system administration that most of us deal with day after day.

Steganography can be used for hidden communication. We have explored the limits of
steganography theory and practice. We printed out the enhancement of the image
steganography 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.

This steganography application software provided for the purpose to how to use any type of
image formats to hiding any type of files inside their. The master work of this application is in
supporting any type of pictures without need to convert to bitmap, and lower limitation on file
size to hide, because of using maximum memory space in pictures to hide the file.

Bibliography
Websites
Following websites are referring to create this project reports.

 http://www.asp.net
 http://www.asp123.com
 http://www.wikipedia.org

Books
Following books and ebook are used to complete this project reports.

 Mastering C# (Paperback)
 .NET Black Book (Paperback)
 Professional C#, 2nd Edition (Paperback)
 Professional ASP.NET (Paperback)
 MCAD/MCSD Self-Paced Training Kit: Developing Web Applications with
Microsoft® Visual Basic® .NET and Microsoft Visual C#® .NET, Second Edition

Index

1. Objective and Scope of the Project


2. Theoretical Background
a. Analysis of Digital Image
b. Analysis of Digital Audio

3. Definition of the Problem

4. System Analysis and Design


a. Context Diagram
b. Data Flow Diagram
c. Encoding
d. Decoding
e. Algorithms

5. Software and Hardware Environment


a. About the Software and Methodology
b. Functions

6. System Implementation

7. System Maintenance

8. Cost and Benefit Analysis

9. Project Life Cycle


a. Input and Output Screen Design
b. Process involved
c. Methodology used for testing:
d. Source code
e. User Manual

Annexure
1. References
 Bibliography
 Websites

2. Keywords
Objective and Scope of the Project
Objective
The objective of steganography is covert communication. So, a fundamental requirement of this
steganography system is that the hider message carried by stego-media should not be sensible to
human beings.

The other objective of steganography is to avoid drawing suspicion to the existence of a hidden
message. This approach of information hiding technique has recently became important in a number of
application area

This project has following objectives:

• To product security tool based on steganography techniques.

• To explore techniques of hiding data using encryption module of this project

• To extract techniques of getting secret data using decryption module.

Steganography sometimes is used when encryption is not permitted. Or, more commonly,
steganography is used to supplement encryption. An encrypted file may still hide information using
steganography, so even if the encrypted file is deciphered, the hidden message is not seen

Scope of Steganography

Steganography is a very interesting and advantageous science these days and has following
uses:

 Digital Watermarking

To protect a copyright on information. Photo collections, sold on CD, often have hidden
messages in the photos which allow detection of unauthorized use. The same technique
applied to DVDs is even more effective, since the industry builds DVD recorders to detect and
disallow copying of protected DVDs.

 The simplest and oldest are used in map making, where cartographers sometimes add
a tiny fictional street to their maps, allowing them to prosecute copycats.
 A similar trick is to add fictional names to mailing lists as a check against
unauthorized resellers.
 Steganography doesn't just apply to written forms of communication. Radio and TV
messages, from World War II to today, can be used to hide coded or hidden messages.
Some government sources suspect that Osama bin Laden's pre- recorded videos that are
re-played on TV stations around the world contain hidden messages.

 Even biological data, stored on DNA, may be a candidate for hidden messages, as
biotech companies seek to prevent unauthorized use of their genetically engineered
material. The technology is already in place for this: three New York researchers
successfully hid a secret message in a DNA sequence and sent it across the country.

 Steganography can also be used to allow communication within an


underground community.

 Steganography is used by some modern printers, including HP and Xerox brand


color laser printers. Tiny yellow dots are added to each page. The dots are barely
visible and contain encoded printer serial numbers, as well as date and time stamps.
Overview

The word steganography comes from the Greek “Seganos”, which mean covered or secret and –
“graphy” mean writing or drawing. Therefore, steganography mean, literally, covered writing. It
is the art and science of hiding information such its presence cannot be detected and a
communication is happening. A secrete information is encoding in a manner such that the very
existence of the information is concealed. Paired with existing communication methods,
steganography can be used to carry out hidden exchanges.

The main goal of this projects it to communicate securely in a completely undetectable manner
and to avoid drawing suspicion to the transmission of a hider data. There has been a rapid growth
of interest in steganography for two reasons:

The publishing and broadcasting industries have become interested in techniques for hiding
encrypted copyright marks and serial numbers in digital films, audio recordings, books and
multimedia products

Moves by various governments to restrict the availability of encryption services have motivated
people to study methods by which private messages can be embedded in seemingly innocuous
cover messages.

The basic model of steganography consists of Carrier, Message and password. Carrier is also
known as cover-object, which the message is embedded and serves to hide the presence of the
message.
Basically, the model for steganography is shown on following figure:

Cover-object, C

F(X,M,K)

Message, M Stego Object, Z

Stego-key, K

Message is the data that the sender wishes to remain it confidential. It can be plain text,
ciphertext, other image, or anything that can be embedded in a bit stream such as a copyright
mark, a covert communication, or a serial number. Password is known as stego-key, which
ensures that only recipient who know the corresponding decoding key will be able to extract the
message from a cover-object. The cover-object with the secretly embedded message is then
called the Stego-object.

Recovering message from a stego-object requires the cover-object itselt and a corresponding
decoding key if a stego-key was used during the encoding process. The original image may or
may not be required in most applications to extract the message.

There are several suitable carriers below to be the cover-object:

 Network protocols such as TCP, IP and UDP

 Audio that using digital audio formats such as wav, midi, avi, mpeg, mpi and
voc

 File and Disk that can hides and append files by using the slack space

 Text such as null characters, just alike morse code including html and java
 Images file such as bmp, gif and jpg, where they can be both color and gray-scale.

In general, the information hiding process extracts redundant bits from cover-object. The
process consists of two steps:

 Identification of redundant bits in a cover-object. Redundant bits are those bits


that can be modified without corrupting the quality or destroying the integrity of
the cover-object.

 Embedding process then selects the subset of the redundant bits to be replaced
with data from a secret message. The stego-object is created by replacing the
selected redundant bits with message bits.

Steganography vs Cryptography:

Basically, the purpose of cryptography and steganography is to provide secret communication.


However, steganography is not the same as cryptography. Cryptography hides the contents of a
secrete message from a malicious people, whereas steganography even conceal the existence of
the message. In cryptography, the system is broken when the attacker can read the secret
message. Breaking a steganography system need the attacker to detect that steganography has
been used.

It is possible to combine the techniques by encrypting message using cryptography and then
hiding the encrypted message using steganography. The resulting stego-image can be
transmitted without revealing that secret information is being exchanged.

.S

Functions
( built in C
THEORETICAL BACKGROUND

ANALYSIS OF DIGITAL IMAGE

An image file is merely a binary file containing a binary representation of the


color or light intensity of each picture element (pixel) comprising the image.
Images typically use either 8-bit or 24-bit color.

When using 8-bit color, there is a definition of up to 256 colors forming a palette for this
image, each color denoted by an 8-bit value.

A 24-bit color scheme, as the term suggests, uses 24 bits per pixel and provides a much
better set of colors. In this case, each pixel is represented by three bytes, each byte representing
the intensity of the three primary colors red, green, and blue (RGB), respectively. The color
orange, for example, would be displayed with red set to 100% , green set to 50% and no blue .

The size of an image file, then, is directly related to the number of pixels
and the granularity of the color definition. A typical 640x480 pix image using a palette of
256 colors would require a file about 307 KB in size (640 • 480 bytes), whereas a 1024x768 pix
high-resolution 24-bit color image would result in a 2.36 MB file (1024 • 768 • 3 bytes).

To avoid sending files of this enormous size, a number of compression schemes have been
developed over time, notably Bitmap (BMP), Graphic Interchange Format (GIF), and
Joint Photographic Experts Group (JPEG) file types. Not all are equally suited to
steganography, however.

GIF and 8-bit BMP files employ what is known as lossless compression, a scheme that allows
the software to exactly reconstruct the original image. JPEG, on the other hand, uses lossy
compression, which means that the expanded image is very nearly the same as the original but not
an exact duplicate. Lossless compression is much better suited to applications where the integrity of
the original information must be maintained, such as steganography. While JPEG can be used for
stego applications, it is more common to embed data in GIF or BMP files.
The simplest approach to hiding data within an image file is called Least Significant
Bit (LSB) insertion. In this method, we can take the binary representation of the hidden_data
and overwrite the LSB of each byte within the cover_image. If we are using 24-bit color, the
amount of change will be minimal and indiscernible to the human eye. As an example, suppose
that we have three adjacent pixels (nine bytes) with the following RGB encoding:

10010101 00001101 11001001


10010110 00001111 11001010
10011111 00010000 11001011

Now suppose we want to "hide" the following 9 bits of data (the hidden data is usually
compressed prior to being hidden): 101101101. If we overlay these 9 bits over the LSB of the 9
bytes above, we get the following (where bits in bold have been changed):

10010101 00001100 11001001


10010111 00001110 11001011
10011111 00010000 11001011

Note that we have successfully hidden 9 bits but at a cost of only changing 4, or roughly
50%, of the LSBs.

A 640x480 pixel image, the size of a small computer monitor, can hold over 400,000
characters. That's a whole novel hidden in one modest photo! This poject involves following
formats of images:

Bitmap Images (.bmp)


Joint Photographic Experts Group Portable Network
(.jpg) Graphics Tagged Image File F
(.png)
(.tif)
(.wmf)
BMP Image File Format

File Header

Data Size(Bytes)
File Type(BM in case of BMP files) 2
File Size 4
Reserved Byte(Always 0) 1
Reserved Byte(Always 0) 1
Bf of Bits
Size of Info Header 4
Width of Bitmap 2
Height of Bitmap 2
No of planes(1 for BMP) 1
Bit Count(Bits/Pixel, Must be 1, 4, 8, 24) 1
Type of Compression used(none) 2
Size of Image Data in Bytes 2
Horizontal Resolution in Pixels/Meter 2
Vertical Resolution in Pixels/Meter 2
No of Color’s Indexes Used 2
Important Color Indexes 2

Reading Pixel Values

Data Size(Bytes)
R(Red) 1
B(Blue) 1
G(Green) 1
Reserved Word for RGB 1
ANALYSIS OF DIGITAL AUDIO

Digital audio differs from traditional analog sound in that it is a discrete rather than continuous
signal. A discrete signal is created by sampling a continuous analog signal at a specified rate. For
example, the standard sampling rate for CD digital audio is about 44kHz. The following figure
illustrates a continuous analog sound wave being sampled to produce digital audio. Note the
sinusoidal nature of a sound wave.

We emphasize the discrete nature of a digital signal in the diagram. However, standard sampling rates
are usually set at a level where the resultant digital signal is visually indistinguishable from the original
analog signal.

Digital audio is stored on a computer as a sequence of 0's and 1's. With the right
tools, it is possible to change the individual bits that make up a digital audio file. Such precise
control allows changes to be made to the binary sequence that are not discernible to the human
ear. The secret message is embedded by slightly altering the binary sequence of a sound file.

The key innovation in recent years was to choose an innocent looking cover that contains plenty
of random information, called white noise. You can hear white noise as a the nearly silent hiss of
a blank tape playing. The secret message replaces the white noise, and if done properly it will
appear to be as random as the noise was. Thus the basic design principle of steganographic
systems is “replacing high entropy noise with a high entropy secret transmission” .
Wave File Format

Wave Header

Data Size(Bytes)
Header Name(RIFF) 4
File Size 4
Format Name(wave) 4
Key Word(fmt) 4
Channels(Mono = 1, Stereo = 2) 1
Frequency 4
Blank(Less Important Data) 6
Bit Resolution 1
Blank(Less Important Data) 12

Wave Data

Data Size(Bytes)
Sound Length 1
Frequency 1
Sample Data Rest Of Wave File
Definition of the Problem
The former consists of linguistic or language forms of hidden writing. The later, such as invisible
ink, try of hide messages physically. One disadvantage of linguistic steganography is that users
must equip themselves to have a good knowledge of linguistry. In recent years, everything is
trending toward digitization. And with the development of the internet technology, digital media
can be transmitted conveniently over the network. Therefore, messages can be secretly carried by
digital media by using the steganography techniques, and then be transmitted through the internet
rapidly

Steganography is the art of hiding the fact that communication is taking place, by hiding
information in other information. Many different carrier file formats can be used, but digital
images are the most popular because of their frequency on the internet. For hiding secret
information in images, there exists a large variety of steganography techniques some are more
complex than others and all of them have respective strong and weak points.

So we prepare this application, to make the information hiding more simple and user
friendly.
System Analysis and Design
System Analysis
Existing System:

Now a days, several methods are used for communicating confidential messages for
defense purposes or in order to ensure the privacy of communication between two parties. So we
go for hiding information in ways that prevent its detection.

Some of the methods used for privacy communication are the use of invisible links; covert
channels are some of existing systems that are used to convey the messages.

Since at present everything is done manually, it is having a lot of drawbacks. The major
Drawback of the present system is the bulk amount of physical volume of the data making
information search and retrieval is tedious Process. There are chances for damage of papers
containing information. So this process is time consuming process.

Drawbacks:

• Increased time

• Low accuracy

• High labour charges

• Increased uncertainty

• Data security is less

Proposed System:

The proposed system uses Image file as a carrier medium which add another step in
security. The objective of the newly proposed system is to create a system that makes it very
difficult for an opponent to detect the existence of a secret message by encoding carrier medium as
a function of some secret key and that remains as the advantage of this system.

This system have several advantages over the existing system. They are

1. Data security is high.

2. It avoids data redundancy and ensures data integrity.

3. It doesn’t take more labour time.


Feasibility Study:

The feasibility of the project is analyzed in this phase and business proposal is set forth
with a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the proposed
system is not a burden to the company. For feasibility analysis, some understanding of the major
requirements for the system is essential.

Three key considerations involved in the feasibility analysis are

1. Economical feasibility

2. Technical feasibility

3. Social feasibility

1. Economical feasibility:

This study is carried out to check the economic impact for the system will have on the
organization. The amount of fund that the company can pour into the research and development
of the system is limited. The expenditures must be justified. Thus the developed system as well
within the budget and this was achieved ,because most of the technologies used are freely
available. Only the customized products had to be purchased.

2. Technical feasibility:

If study is carried out to check about the technical requirements of the system. Any system
developed must not have a high demand on the available technical resources. This will lead to
high demands on the available technical resources. This will lead to high demands being placed on
the client. The developed system must have a modern requirement, as only minimal or null
changes are required for implementing this system.

3. Social feasibility:

The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept as a necessity. The level of acceptance by the users
solely depends on the methods that are employed to educate the user about the system and to make
him familiar with it. His level of confidence must be raised ,so that also able to make some
constructive criticism, as he is the final user of the system.
CONTEXT DIAGRAM

PLAIN TEXT OR
COVER MEDIUM TEXT FILE STEGNO
KEY
(Image or Audio File) (Text to be Hidden)

STEGNO-ENCODING
TOOL

STEGNO
MEDIUM

STEGNO-DECODING
TOOL

.DAT FILE CONTAINING

HIDDEN TEXT
DATA FLOW

DIAGRAM ENCODING

STEGNO
PLAIN
TEXT KEY
Vigenere
Cipher
Arithmetic
Encripted coding
Text
Conversion
into ASCII
form Key
Conversion Information
into 8-bit
form

Bit
Stream

Read the Audio in


Frequency Values Using Key
in Byte form Information Encode
Bit Stream in the
COVER Bit/Byte Stream of
MEDIUM Cover Medium
Read the Image in
RGB values of
pixel in Bit form
Resultant Bit/
Byte Stream

STEGNO
MEDIUM
DECODING

Arithmetic
STEGNO Key
KEY coding
Information

Read the Audio in


Frequency Values Using Key
in Byte form Information
Decode Bit
STEGNO Stream in the
MEDIUM Bit/Byte Stream
Read the Image in
RGB values of
pixel in Bit form

Bit Stream of
Hidden Text

Conversion into
8-bit
form Conversion
into ASCII
Form

Vigenere Encripted
Cipher Text

ORIGINAL
TEXT
ALGORITHMS

ENCODING

Least significant bit (LSB) coding is the simplest way to embed information in a digital Image or
Audio file. By substituting the least significant bit of each sampling point in Audio and each pixel in
Image with a binary message, LSB coding allows for a large amount of data to be encoded.

The following diagram illustrates how the message 'HEY' is encoded in a 16-bit CD quality sample
using the LSB method:

In LSB coding, the ideal data transmission rate is 1 kbps per 1 kHZ.
ALGORITHM FOR ENCODING

STEP 1. //Information from Stegno Key

Input the key in string datatype;

//Apply Arithmetic coding to the string key float num =


Arithmetic_coding( key); num=num*100;

x=10*(1st digit of num); y=10*(2st digit of num);

STEP 2. //converting Plain Text into Bit Stream

//Input Text to be hidden in string datatype;


string plaintext;
//apply encription algorithm on this string string
ciphertext = Vigenere_cipher(plaintext); convert
ciphertext ASCII form;
convert ASCII form Bit_stream;

STEP 3. //Hiding bitstream of input text in Image or Audio file int n


= length(plaintext);

//HIDING IN IMAGE FILE

get_resolution( image )  pxq; if (p==odd)

p=p-1; if(q==odd) q=q-1;

R value of 1x1 pixel = n; int g =1;

int h=1;

int m= bit lodation in Bit_stream; char C= R or G or B;

for(int i=0;i<8n;i++)

If (m%3==1) C=R;

If (m%3==1) C=G;

If (m%3==1) C=B
Least significant digit of C value of (g+x)x(h+y) th pixel =
Bit_stream[i];

g = g+x; h = h+y;

//HIDING IN AUDIO FILE

string audio_stream= sampled audio Byte_stream;


audio_stream[0]= n;

for(int i=0;i<8n;i++)

If (Bit_stream[i]==0) audio_stream[i++]=audio_stream[i++] AND


“11111110”;

If (Bit_stream[i]==1) audio_stream[i]=audio_stream[i] OR
“00000001”;

}
ALGORITHM FOR DECODING

STEP 1. //Information from Stegno Key

Input the key in string datatype;

//Apply Arithmetic coding to the string key float num =


Arithmetic_coding( key); num=num*100;

x=10*(1st digit of num); y=10*(2st digit of num);

//from IMAGE file

STEP 2. //read stegno image

int n= R value of 1x1 pixel int g=0;

int h=0;

STEP 3. for(int i=1; i<=n;i++)

g=g+x;

h=h+y;

string Bit_stream;

char C;

If (i%3==1) C=R;

If (i%3==1) C=G;

If (i%3==1) C=B;

Bit_stream[i--]=least significant digit of C value of (gxh) pixel

}
// from Audio file
STEP 2. //read stegno audio

string audio_stream= sampled stegno audio Byte_stream; int n = audio_stream[0];

STEP 3. for(int i=1;i<8n;i++)

Bit_stream[i]=least significant digit of audio_stream[i];

STEP 4. //converting Bit Stream into Plain Text

string ciphertext ;

convert Bit_stream  ASCII form; convert ASCII form  ciphertext;

//apply dencription algorithm on this string

string plaintext = inverse_Vigenere_cipher(ciphertext); PRINT plaintext;


Vigenere Cipher

Plain text: ATTACKATDAWN

Key: LEMONLEMONLE

Cipher text: LXFOPVEFRNHR

The person sending the message chooses a keyword and repeats it until
it matches the length of the plaintext, for example, the keyword
"LEMON" makes: Key: LEMONLEMON
Software & Hardware Environment

Software Environment
 Operating System : Window XP
 Development Environment : MS Visual
Studio .Net Framework 4.5
 Languages : C#.Net

Hardware Environment
 Processor : Intel®
Core™ i3-4005U CPU @ 1.70 GHz
 RAM : 8 GB
 Hard Disk : 250 GB
 Mother Board : Intel
chipset board
 Mouse : Logitech
optical mouse
 Key Board : 104 keys
keyboard

About the software and Methodology

What is .Net?

When .NET was announced in late 1999, Microsoft positioned the


technology as a platform for building and consuming Extensible Markup
Language (XML) Web services. XML Web services allow any type of
application, be it a Windows- or browser-based application running on
any type of computer system, to consume
data from any type of server over the Internet. The reason this idea is so
that this is the way in which the XML messages are transferred: over
established standard protocols that exist today. Using protocols such as
SOAP, HTTP, and SMTP, XML Web services make it possible to
expose data over the wire with little or no modifications to your existing
code.

Figure presents a high-level overview of the .NET Framework and how


XML Web services are positioned.

Stateless XML Web services model

Since the initial announcement of the .NET Framework, it's taken on


many new and different meanings to different people. .NET developer
creates great environment for robust distributed applications. The role of
IT manager,to deployment of applications to end users, tighter security,
and simpler management. For the above statement, we need to get a grip
on what the .NET Framework consists of, and how it's truly a
revolutionary step forward for application architecture, development,
and deployment.
.NET Framework
We are familiar with the major goals of the .NET Framework, and its
architecture. As the .NET Framework lays on top of the operating
system, which can be a few different compound of Windows .NET is a
system application that needs a Windows operating system.
Conceptually, the CLR and the JVM are similar in that they are both
runtime infrastructures that abstract the underlying platform differences.
However, while the JVM officially supports only the Java language, the
CLR supports any language that can be represented in its Common
Intermediate Language (CIL). The JVM executes byte code, so it can, in
principle, support many languages,. Unlike Java's byte code,

though CIL is never interpreted. Conceptual difference between the two


infrastructures is that Java code runs on any platform with a JVM,
whereas .NET code runs only on platforms that support the CLR.

The Common Language Runtime


The heart of the .NET Framework is the common language runtime.
The common language runtime is responsible for providing the
execution environment that code written in a .NET language runs
under. The common language runtime can be compared to the Visual
Basic 6 runtime, except that the common language runtime is designed
to handle all .NET languages, not
any one. The mention below are list describes the benefits of
common language runtime:

• Automatic memory management

• Cross-language debugging

• Cross-language exception handling

• Full support for component versioning

• Access to legacy COM components

• XCOPY deployment

• Robust security model

You might expect all those features, but this has never been possible
using Microsoft development tools. Figure shows where the common
language runtime fits into the .NET Framework.

Fig. The Common Language Runtime

Note

Code written using a .NET language is known as managed code. Code that
uses anything but the common language runtime is
known as unmanaged code. The common language runtime provides a
managed execution environment for .NET code, whereas the individual
runtimes of non-.NET languages provide an unmanaged execution
environment.

Inside the Common Language Runtime


The common language runtime enables code running in its
execution environment to have features such as security, versioning,
memory management and exception handling because of the way .NET
code actually executes. When you compiled Visual Basic 6 forms
applications, you had the ability to compile down to native node or p-
code.

When you compile your applications in .NET, you aren't


creating anything in native code. When you compile in .NET, you're
converting your code—no matter what .NET language you're using—
into an assembly made up of an intermediate language called Microsoft
Intermediate Language.

Note

The file format for the integrated language is known as PE


(portable executable) format, which is a standard format for processor-
specific execution. When a user or another component executes your
code, a process occur called just-in-time (JIT) compilation, and it's at
this point that the IL is converted into the specific machine language of
the processor it's executing on. This makes it very easy to port a .NET
application to any type of operating system on any type of processor
because the IL is simply waiting to be consumed by a JIT compiler.

When the IL code is JITted into machine-specific language, it


does so on an as-needed basis. If your assembly is 10MB and the user is
only using a fraction of that 10MB, only the required IL and its
dependencies are compiled to machine language. This makes for a very
efficient execution process. But during this execution, how does the
common language runtime make sure that the IL is correct? Because the
compiler for each language creates its own IL, there must be a process
that makes sure what's compiling won't corrupt the system. The process
that validates the IL is known as verification. Figure 3.5 demonstrates
the process the IL goes through before the code actually executes.
Fig. The JIT process and verification

When code is JIT compiled, the common language runtime checks to


make sure that the IL is correct. The rules that the common language
runtime uses for verification are set forth in the Common Language
Specification (CLS) and the Common Type System (CTS).

The .NET Framework Class Library


The second most important piece of the .NET Framework is the
.NET Framework class library (FCL). As you've seen, the common
language runtime handles the dirty work of actually running the code
you write. But to write the code, you need a foundation of available
classes to access the resources of the operating system, database server,
or file server. The FCL is made up of a hierarchy of namespaces that
expose classes, structures, interfaces, enumerations, and delegates that
give you access to these resources.

The Structure of a .NET Application


To understand how the common language runtime
manages code execution, you must examine the structure of a
.NET application. The primary unit of a .NET application is the
assembly. An assembly is a self-describing collection of code,
resources, and metadata. The assembly manifest contains information
about what is contained within the assembly.

The assembly mainfest provides:

• Identity information, such as the assembly’s name and version


number

• A list of all types exposed by the assembly

• A list of other assemblies required by the assembly

• A list of code access security instructions, including permissions


required by the assembly and permissions to be denied the assembly

Each assembly has one and only one assembly manifest, and it
contains all the description information for the assembly. However, the
assembly manifest can be contained in its own file or within one of the
assembly’s modules.

Compilation and Execution of a .NET Application


When you compile a .NET application, it is not compiled to
binary machine code; rather, it is converted to IL. This is the form that
your deployed application takes—one or more assemblies consisting of
executable files and DLL files in IL form. At least one of these
assemblies will contain an executable file that has been designated as the
entry point for the application.

When execution of your program begins, the first assembly is


loaded into memory. At this point, the common language runtime
examines the assembly manifest and determines the requirements to run
the program. It examines security permissions requested by the
assembly and compares them with the system’s security policy. If the
system’s security policy does not allow the requested permissions, the
application will not run. If the application passes the system’s security
policy, the common
¬language runtime executes the code. It creates a process for the
application to run in and begins application execution.

The .NET Framework base class library contains the base classes
that provide many of the services and objects you need when writing
your applications. The class library is organized into namespaces. A
namespace is a logical grouping of types that
perform related functions. Namespaces are logical groupings of related
classes. The namespaces in the .NET base class library are organized
hierarchically. The root of the .NET Framework is the system
namespace. Other namespaces can be accessed with the period operator.
A typical namespace construction appears as follows:

System

System.Data

System.Data.SQLClient

.Net Namespaces
Table 1-1. Representative .NET Namespaces

Namespace Description

System
This namespace is the root for many of
the low-level types required by
the .NET Framework. It is the root for
primitive data types as well, and it is the
root for all the other namespaces in the
.NET base class library.

System.Collections This namespace contains classes that


represent a variety of different container
types, such as ArrayList, SortedList,
Queue, and Stack. You also can find
abstract classes, such as CollectionBase,
which are useful for implementing your
own collection functionality.

System.ComponentModel This namespace contains classes


Table 1-1. Representative .NET Namespaces

Namespace Description

involved in component creation and


containment, such as attributes, type
converters, and license providers.

System.Data This namespace contains classes


required for database access and
manipulations, as well as additional
namespaces used for data access.

System.Data. Common This namespace contains a set of


classes that are shared by the .NET
managed data providers.

System.Data.OleDb This namespace contains classes that


make up the managed data provider for
OLE DB data access.

System.Data.SQLClient This namespace contains classes that are


optimized for interacting with Microsoft
SQL Server.

System.Drawing This namespace exposes GDI+


functionality and provides classes that
facilitate graphics rendering.

System.IO In this namespace, you will find types


for handling file system I/O.

System.Math This namespace is home to common


mathematics functions such as
extracting roots and trigonometry.

System.Reflection This namespace provides support for


Table 1-1. Representative .NET Namespaces

Namespace Description

obtaining information and dynamic


creation of types at runtime.

System.Security This namespace is home to types


dealing with permissions,
cryptography, and code access
security.

System.Threading This namespace contains classes that


facilitate the implementation of
multithreaded applications.

System.Windows.Forms This namespace contains types involved in


creating standard Windows applications.
Classes that represent forms and controls
reside here as well.

Introduction to Object-Oriented Programming


Programming in the .NET Framework environment is done
with objects. Objects are programmatic constructs that represent
packages of related data and functionality. Objects are self-contained
and expose specific functionality to the rest of the application
environment without detailing the inner workings of the object itself.
Objects are created from a template called a class.
The .NET base class library provides a set of classes from which you can
create objects in your applications. You also can use the Microsoft Visual
Studio programming environment to create your own classes. This lesson
introduces you to the concepts associated with object-oriented
programming.
Objects, Members, and Abstraction
An object is a programmatic construct that represents
something. In the real world, objects are cars, bicycles, laptop, and so
on. Each of these items exposes specific functionality and has specific
properties. In your application, an object might be a form.Control such
as a button, a database connection.or any of a number of other
constructs. Each object is a complete functional unit, and contains all of
the data and exposes all of the functionality required to fulfill its
purpose. The ability of programmatic objects to represent real-world
objects is called abstraction.

Classes Are Templates for Objects


Classes represent user-defined reference types. Classes can be
thought of as blueprints for objects: they define all of the members of
an object, define the behavior of an object, and set initial values for
data when appropriate. When a class is initialized, an in-memory
instance of that class is created. This instance is called an object. To
review, a class is instantiated using the New (new) keyword as
follows:

Visual Basic .NET

' Declares a variable of the Widget type

Dim myWidget As Widget

' Instantiates a new Widget object and assigns it to the myWidget '

variable

myWidget = New Widget()

When an instance of a class is created, a copy of the instance


data defined by that class is created in memory and assigned to the
reference variable. Individual instances of a class are independent of
one another and represent separate programmatic constructs.

There is generally no limit to how many copies of a single class


can be initialized at any time. To use a real-world analogy, if a car is an
object, plans for the car are the class. The plans can
be used to make any number of cars, and changes to a single car do not,
for the most part, affect any other cars.

Objects and Members


Objects are composed of members. Members are properties, fields,
methods, and events, and they represent the data and functionality that
comprise the object. Fields and properties represent data members of an
object. Methods are actions the object can perform, and events are
notifications an object receives from or sends to other objects when
activity happens in the application.

Object Models
Simple objects might consist of only a few properties, methods,
and perhaps an event or two. More complex objects might require
numerous properties and methods and possibly even secondary
objects. Objects can contain and expose other objects as members.

Similarly, every instance of the Form class contains and exposes a


controls collection that comprises all of the controls contained by the form.
The object model defines the hierarchy of contained objects that form the
structure of an object.

Encapsulation
Encapsulation is the concept that implementation of an object
is independent of its interface. Put another way, an application
interacts with an object through its interface, which consists of its
public properties and methods. As long as this interface remains
constant, the application can continue to interact with the component,
even if implementation of the interface was completely rewritten
between versions.

Polymorphism
Polymorphism is the ability of different classes to provide
different implementations of the same public interfaces. In other words,
polymorphism allows methods and properties of an object to be called
without regard for the particular implementation of those members.
There are two principal ways through which polymorphism can be
provided: interface polymorphism and inheritance polymorphism.

Interface Polymorphism
An interface is a contract for behavior, it defines the members a
class should implement, but states nothing at all about the details of that
implementation. An object can implement many different interfaces,
and many diverse classes can implement the same interface. All objects
implementing the same interface are capable of interacting with other
objects through that interface.

Inheritance Polymorphism
Inheritance allows you to incorporate the functionality of a
previously defined class into a new class and implement different
members as needed. A class that inherits another class is said to derive
from that class, or to inherit from that class. A class can directly inherit
from only one class, which is called the base class. The new class has
the same members as the base class, and additional members can be
added as needed.
Additionally, the implementation of base members can be changed in
the new class by overriding the base class implementation. Inherited
classes retain all the characteristics of the base class and can interact
with other objects as though they were instances of the base class.

Microsoft Visual Basic.Net


With its release for the .NET platform, the Visual Basic language has
undergone dramatic changes. For example:

 The language itself is now fully object-oriented.


 Applications and components written in Visual Basic .NET have
full access to the .NET Framework, an extensive class library
that provides system and application services.
 All applications developed using Visual Basic .NET run
within a managed runtime environment, the .NET common language
runtime.

FUNCTIONS
 private void generate_bincodes()

It is used to convert the string into binary codes or bit stream.This function
uses the class stack to perform this task.

 private void text_encrypt()

It is used to encrypt the plain text using vigenere cipher.

 private string text_decrypt()

It is used to decrypt the text which is generated from the stegno medium.

 private float get_key()

This function is used to manipulate the stegno key.

 Public Bitmap encrypt()

This is the function responsible for hiding encryted text in the


image file

 public string decrypt()

This is the function responsible for decoding the stegno medium.


System Implementation
Implementation
Implementation is the stage in the project where the theoretical design
of the project is turned into a working system. It is a stage where the
operation of the system is monitored to ensu re that it continues to work
effectively. Education and training of the users are also essential to ensure
smooth functioning of the system.
The major tasks involved in the implementation are:
• Computer based/system testing.
• Training the user personnel
• Full system testing and making the necessary changes as desired by the
user.
• Change over.
• Maintenance.
The implementation strategy used is the parallel changeover.
The automated system has been put to use gradually so that its usage can prove
better for the concern.
After the system has been tested, the implementation type or the
change over technique from the existing system to the new system is a step-
by-step process. In the system, at first only a module of the system is
implemented and checked for suitability and efficiency. When the end-user
related to the particular module is satisfied with the performance, the next
step of implementation is preceded.
Implementation to some extent is also parallel. For instance, modules,
which are not linked, with other modules are implemented parallel and the
remaining is the step-by-step process.
Backups are necessary since any time unexpected events may happen.
And so during the program execution, the records are stored in the
workspace. This helps to recover the original status of the records from any
accidental updating or intentional deletion of records.

Implementation Procedures
Implementation means converting older system to a new design in
operation. This involves creating computer capable files and basic software
needed to run this system. The basic concept for implementation needed is
software installation and system requirements. So in order to implement
them, suitable hardware and software must be available. Then the database
must be created in the
computer without changing the database names which are used in the table
design.
Now the computer is ready for implementing the proposed system.
There are three types of implementation.
 Implementation of a new computer system to replace a
manual one.
 Implementation of a new computer system to replace an
existing one.
 Implementation a modified application to replace an
existing one.

User Training
Planning for user acceptance testing calls for the analyst and the user to
agree on the condition for the test. Many of these conditions may be
derived from the test plan. Others are an agreement on the test schedule,
the test duration and the test should be specified in advance.

Plan User Training


User training is designed to prepare the user for testing and converting
the system. User involvement and training take place parallel with
programming for three reasons:
• The system group has time available to spend on training while the
program is being written.
• Initiating a user-training program gives the system group a clears
image of the user’s interest in the new system.
• A trained user participates more effectively in system testing.
For user training, preparation of a checklist is useful. Included are
provisions for developing training materials and other documents to
complete the training activity. In effect, the checklist call for a commitment
of personnel, facilities and effort for implementing the candidate system

The training plan is followed by preparation of the user training manual and
other text materials. Facility requirements and the necessary hardware are
specified and documented. A common procedure is to train supervisors and
heads who, in turn train their staff as they fit.

Operational Documentation
In operational document, the general idea is about explaining different
module of this project. The detail explanation of this operational document is
to know the form infrastructure. There are different forms that have different
features, when it is selected then this displays the particular detail about the
particular contents. The content will display all the details about the fields. In
the particular form we can add, edit, delete and update can be made. Each
form displays the particular module to perform this operation.
System Maintenance

Software maintenance is of course, redefining the system uniform. Provision


must be made for environment changes, which may affect either the computer,
or other parts of the computer based systems. Such activity is normally called
maintenance. It includes both the improvement of the system functions and the
correction of faults, which arise during the operation of a new system.

It may involve the continuing involvement of a large proportion of computer


department resources. The main task may be to adapt existing systems in a
changing environment. Systems should not be changed casually following
informal requests. To avoid unauthorized amendments, all requests for
changes should be channeled to a person nominated by management. The
nominated person has sufficient knowledge of the organization’s computer
based systems to be able to judge the relevance of each proposed change.
Project Life Cycle

Flow chart for Image Steganography


Flow chart for Audio Steganography
Sequence Diagram for Image Steganography
Data Flow Diagram for Image Steganography
Data Flow Diagram for Audio Steganography

System Testing
Testing is the process of executing the program with the intent of
finding errors. During testing, the program to be tested and executed
with a set of test cases and the output of the program for the test cases is
evaluated to determine the program is performing as it is expected.
Error is the testing fundamental and is defined as the difference between
the actual output of a software and a correct output i.e., difference
between the actual and ideal testing is usually relied upon to detect these
faults in the coding phase for this, different levels of testing are used
which performs different tasks and aim to the test different aspects of
the system.

Goals of Testing:
The famous statement by Dijkstra (in Dahl et al. 1972) is a
perfect synthesis of the goals of the testing. If the results delivered by
the system are different from the expected ones in just one case, in this
unequally shows that the system is incorrect: by contrast, a correct
behavior of the system on a finite number of cases does not guarantee
correctness in the general case. For instance, we could have built a
program that behaves properly for even integer numbers but not odd
numbers. Clearly, any number of tests with even input values will face
to show the error.

Testing should be based on sound and systematic


techniques so that, after testing, we may have a better
understanding of the product’s reliability.

Testing should help locate errors, not just detect their


presence. The result of testing should not be viewed as simply
providing a Boolean answer to the question of whether the software
works properly or not.

Tests should be organized in a way that helps to isolate


errors. This information can then be used in debugging.

Testing should be repeatable, i.e., tests should be arranged in such


a way that separating the same experiment-supplying the same input
data to the same piece of code – produces the same results.

Finally testing should be accurate – this will increase the reliability of


testing. Here we should observe that the accuracy of
the testing activity depends on the level of precision and may be even
formality of software specifications.

Testing Methodologies:

 Unit Testing

In it different modules are tested against the specifications


produced during design for the modules. It is essential for verification
of the code produced during the code phase and the goal is to test the
internal logic of the module.

 Integration Testing
The goal here is to see if the modules can be integrated properly,
the emphasis being on testing interfaces between modules. After
structural testing and functional testing we get error free modules these
modules are to be integrated to get the required results of the system.
After checking the module another module is tested and is integrated
with the previous module.

After the integration the test phases are generated and the results are
tested.

 System Testing

Here the entire software is tested. The reference document


for this process is the requirement document and the goal is to see
whether the software needs its requirements.

The system was tested for various test cases with various inputs.

 Validation Testing
In this testing the software is tested to determine whether it
suits to that particular environment. Validation testing provides the final
assurance that the software meets all functional, behavioral and
performance requirements. Validation refers to the process of using the
software in a live environment to find errors. During the course of
validation the system failure may occur and software will be changed.
Tested all the fields whether accepting the valid input or not.

 Acceptance Testing
It is sometimes performed with realistic data of the client to
demonstrate that the software is working satisfactorily. Testing here
focus on the external behavior of the system, the internal logic of the
program is not emphasized.

In acceptance test the system is tested for various inputs. Thus


different types of testing are performed.

 Black Box Testing

Here the structure of the program is not considered.


Only the test cases are decided solely on the basis of the requirements or
specification of the program or module and the internal details of the
module or the program is not considered for the selection of test cases.
This is also called “Black Box Testing” or “Functional Testing”.

Incorrect or missing functions.


➢ Performance errors.
➢ Database access errors
➢ Initialization and termination

 White Box Testing


It is considered with testing the implementation of the program.
The intention of the structural testing is not to exercise all the different
input and output conditions but to exercise the different programming
and data files used in the program. This testing is also called “White
Box Testing” or Structural Testing.

Source Code
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace Steganography
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Steganography ());
}
}
}

Steganography.cs
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;

namespace Steganography
{
public partial class Steganography : Form
{
private Bitmap bmp = null;
private string extractedText = string.Empty;

public Steganography()
{
InitializeComponent();
}

private void hideButton_Click(object sender, EventArgs e)


{
bmp = (Bitmap)imagePictureBox.Image;

string text = dataTextBox.Text;

if (text.Equals(""))
{
MessageBox.Show("The text you want to hide can't be empty",
"Warning");

return;
}
if (encryptCheckBox.Checked)
{
if (passwordTextBox.Text.Length < 6)
{
MessageBox.Show("Please enter a password with at least 6
characters", "Warning");

return;
}
else
{
text = Crypto.EncryptStringAES(text, passwordTextBox.Text);
}
}

bmp = SteganographyHelper.embedText(text, bmp);

MessageBox.Show("Your text was hidden in the image


successfully!", "Done");

notesLabel.Text = "Notes: don't forget to save your new image.";


notesLabel.ForeColor = Color.OrangeRed;
}

private void extractButton_Click(object sender, EventArgs e)


{
bmp = (Bitmap)imagePictureBox.Image;

string extractedText = SteganographyHelper.extractText(bmp);

if (encryptCheckBox.Checked)
{
try
{
extractedText = Crypto.DecryptStringAES(extractedText,
passwordTextBox.Text);
}
catch
{
MessageBox.Show("Wrong password", "Error");

return;
}
}

dataTextBox.Text = extractedText;
}

private void imageToolStripMenuItem1_Click(object sender,


EventArgs e)
{
OpenFileDialog open_dialog = new OpenFileDialog();
open_dialog.Filter = "Image Files (*.jpeg; *.png; *.bmp)|*.jpg;
*.png; *.bmp";

if (open_dialog.ShowDialog() == DialogResult.OK)
{
imagePictureBox.Image =
Image.FromFile(open_dialog.FileName);
}
}
private void imageToolStripMenuItem_Click(object sender,
EventArgs e)
{
SaveFileDialog save_dialog = new SaveFileDialog();
save_dialog.Filter = "Png Image|*.png|Bitmap Image|*.bmp";

if (save_dialog.ShowDialog() == DialogResult.OK)
{
switch (save_dialog.FilterIndex)
{
case 0:
{
bmp.Save(save_dialog.FileName, ImageFormat.Png);
}break;
case 1:
{
bmp.Save(save_dialog.FileName, ImageFormat.Bmp);
} break;
}

notesLabel.Text = "Notes:";
notesLabel.ForeColor = Color.Black;
}
}

private void textToolStripMenuItem_Click(object sender, EventArgs


e)
{
SaveFileDialog save_dialog = new SaveFileDialog();
save_dialog.Filter = "Text Files|*.txt";

if (save_dialog.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(save_dialog.FileName, dataTextBox.Text);
}
}

private void textToolStripMenuItem1_Click(object sender, EventArgs


e)
{
OpenFileDialog open_dialog = new OpenFileDialog();
open_dialog.Filter = "Text Files|*.txt";

if (open_dialog.ShowDialog() == DialogResult.OK)
{
dataTextBox.Text = File.ReadAllText(open_dialog.FileName);
}
}

private void aboutToolStripMenuItem_Click(object sender, EventArgs


e)
{
MessageBox.Show("By: Shrikant Pokharkar @ April 2015",
"About");
}

private void notesLabel_Click(object sender, EventArgs e)


{

}
private void groupBox2_Enter(object sender, EventArgs e)
{

private void groupBox3_Enter(object sender, EventArgs e)


{

}
}
}

Steganography.Designer.cs
namespace Steganography
{
partial class Steganography
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.hideButton = new System.Windows.Forms.Button();
this.dataTextBox = new System.Windows.Forms.TextBox();
this.extractButton = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.imageToolStripMenuItem1 = new
System.Windows.Forms.ToolStripMenuItem();
this.textToolStripMenuItem1 = new
System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.imageToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.textToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.encryptCheckBox = new System.Windows.Forms.CheckBox();
this.passwordTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.notesLabel = new System.Windows.Forms.Label();
this.imagePictureBox = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.menuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)
(this.imagePictureBox)).BeginInit();
this.SuspendLayout();
//
// hideButton
//
this.hideButton.Font = new System.Drawing.Font("Microsoft Sans
Serif", 15F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hideButton.Image =
global::Steganography.Properties.Resources.lock_icon 1_;
this.hideButton.Location = new System.Drawing.Point(720, 474);
this.hideButton.Margin = new
System.Windows.Forms.Padding(4);
this.hideButton.Name =
"hideButton";
this.hideButton.Size = new System.Drawing.Size(241, 53);
this.hideButton.TabIndex = 0;
this.hideButton.Text = "Hide";
this.hideButton.UseVisualStyleBackColor = true;
this.hideButton.Click += new
System.EventHandler(this.hideButton_Click);
//
// dataTextBox
//
this.dataTextBox.Font = new System.Drawing.Font("Tahoma",
12F);
this.dataTextBox.Location = new System.Drawing.Point(562,
107);
this.dataTextBox.Margin = new
System.Windows.Forms.Padding(4);
this.dataTextBox.Multiline = true;
this.dataTextBox.Name = "dataTextBox";
this.dataTextBox.ScrollBars =
System.Windows.Forms.ScrollBars.Vertical;
this.dataTextBox.Size = new System.Drawing.Size(528, 320);
this.dataTextBox.TabIndex = 2;
//
// extractButton
//
this.extractButton.Font = new System.Drawing.Font("Microsoft
Sans Serif", 15F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.extractButton.Image =
global::Steganography.Properties.Resources.unlock_icon 1_;
this.extractButton.Location = new System.Drawing.Point(720,
594);
this.extractButton.Margin = new
System.Windows.Forms.Padding(4);
this.extractButton.Name = "extractButton";
this.extractButton.Size = new System.Drawing.Size(241, 53);
this.extractButton.TabIndex = 3;
this.extractButton.Text = "Extract";
this.extractButton.UseVisualStyleBackColor = true;
this.extractButton.Click += new
System.EventHandler(this.extractButton_Click);
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new
System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.helpToolStripMenuItem})
;
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new
System.Windows.Forms.Padding(8, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1103, 28);
this.menuStrip1.TabIndex = 5;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.saveToolStripMenuItem});
this.fileToolStripMenuItem.Font = new
System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44,
24);
this.fileToolStripMenuItem.Text = "File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.imageToolStripMenuItem1,
this.textToolStripMenuItem1});
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new
System.Drawing.Size(114, 24);
this.openToolStripMenuItem.Text = "Open";
//
// imageToolStripMenuItem1
//
this.imageToolStripMenuItem1.Name =
"imageToolStripMenuItem1";
this.imageToolStripMenuItem1.Size = new
System.Drawing.Size(120, 24);
this.imageToolStripMenuItem1.Text = "Image";
this.imageToolStripMenuItem1.Click += new
System.EventHandler(this.imageToolStripMenuItem1_Click);
//
// textToolStripMenuItem1
//
this.textToolStripMenuItem1.Name = "textToolStripMenuItem1";
this.textToolStripMenuItem1.Size = new
System.Drawing.Size(120, 24);
this.textToolStripMenuItem1.Text = "Text";
this.textToolStripMenuItem1.Click += new
System.EventHandler(this.textToolStripMenuItem1_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.imageToolStripMenuItem,
this.textToolStripMenuItem});
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new
System.Drawing.Size(114, 24);
this.saveToolStripMenuItem.Text = "Save";
//
// imageToolStripMenuItem
//
this.imageToolStripMenuItem.Name = "imageToolStripMenuItem";
this.imageToolStripMenuItem.Size = new
System.Drawing.Size(120, 24);
this.imageToolStripMenuItem.Text = "Image";
this.imageToolStripMenuItem.Click += new
System.EventHandler(this.imageToolStripMenuItem_Click);
//
// textToolStripMenuItem
//
this.textToolStripMenuItem.Name = "textToolStripMenuItem";
this.textToolStripMenuItem.Size = new System.Drawing.Size(120,
24);
this.textToolStripMenuItem.Text =
"Text"; this.textToolStripMenuItem.Click
+= new
System.EventHandler(this.textToolStripMenuItem_Click);
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(53,
24);
this.helpToolStripMenuItem.Text = "Help";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new
System.Drawing.Size(119, 24);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new
System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// encryptCheckBox
//
this.encryptCheckBox.AutoSize = true;
this.encryptCheckBox.Font = new
System.Drawing.Font("Microsoft Sans Serif", 12F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)
(0)));
this.encryptCheckBox.Location = new System.Drawing.Point(136,
45);
this.encryptCheckBox.Margin = new
System.Windows.Forms.Padding(4);
this.encryptCheckBox.Name = "encryptCheckBox";
this.encryptCheckBox.Size = new System.Drawing.Size(122, 27);
this.encryptCheckBox.TabIndex = 6;
this.encryptCheckBox.Text = "Encrypted";
this.encryptCheckBox.UseVisualStyleBackColor = true;
//
// passwordTextBox
//
this.passwordTextBox.Font = new
System.Drawing.Font("Microsoft Sans Serif", 12F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
this.passwordTextBox.Location = new System.Drawing.Point(136,
100);
this.passwordTextBox.Margin = new
System.Windows.Forms.Padding(4);
this.passwordTextBox.Name = "passwordTextBox";
this.passwordTextBox.PasswordChar = '*';
this.passwordTextBox.Size = new System.Drawing.Size(229, 30);
this.passwordTextBox.TabIndex = 7;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans
Serif", 12F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(8, 103);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4,
0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 25);
this.label1.TabIndex = 8;
this.label1.Text = "Password:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.passwordTextBox);
this.groupBox1.Controls.Add(this.encryptCheckBox);
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans
Serif", 10.2F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.Location = new System.Drawing.Point(16, 474);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new
System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(499, 173);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Do you want
Encryption?";
//
// notesLabel
//
this.notesLabel.AutoSize = true;
this.notesLabel.Font = new System.Drawing.Font("Microsoft Sans
Serif", 12F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.notesLabel.Location = new System.Drawing.Point(11, 695);
this.notesLabel.Margin = new System.Windows.Forms.Padding(4,
0, 4, 0);
this.notesLabel.Name = "notesLabel";
this.notesLabel.Size = new System.Drawing.Size(69, 25);
this.notesLabel.TabIndex = 9;
this.notesLabel.Text = "Notes:";
this.notesLabel.Click += new
System.EventHandler(this.notesLabel_Click);
//
// imagePictureBox
//
this.imagePictureBox.Image =
global::Steganography.Properties.Resources.images;
this.imagePictureBox.Location = new System.Drawing.Point(16,
107);
this.imagePictureBox.Margin = new
System.Windows.Forms.Padding(4);
this.imagePictureBox.Name = "imagePictureBox";
this.imagePictureBox.Size = new System.Drawing.Size(499, 320);
this.imagePictureBox.SizeMode =
System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.imagePictureBox.TabIndex = 4;
this.imagePictureBox.TabStop = false;
//
// groupBox2
//
this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans
Serif", 10.2F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox2.Location = new System.Drawing.Point(562, 54);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new
System.Windows.Forms.Padding(4);
this.groupBox2.Size = new System.Drawing.Size(499, 27);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "ENTER YOUR TEXT
:-"; this.groupBox2.Enter += new
System.EventHandler(this.groupBox2_Enter);
//
// groupBox3
//
this.groupBox3.Font = new System.Drawing.Font("Microsoft Sans
Serif", 10.2F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox3.Location = new System.Drawing.Point(13, 54);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new
System.Windows.Forms.Padding(4);
this.groupBox3.Size = new System.Drawing.Size(499, 27);
this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "SELECT YOUR IMAGE
:-";
this.groupBox3.Enter += new
System.EventHandler(this.groupBox3_Enter);
//
// Steganography
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1103, 738);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.notesLabel);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.imagePictureBox);
this.Controls.Add(this.extractButton);
this.Controls.Add(this.dataTextBox);
this.Controls.Add(this.hideButton);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("Script MT Bold", 7.8F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.Name = "Steganography";
this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MCA_PROJECT_STEGANOGRAPHY";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)
(this.imagePictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

#endregion

private System.Windows.Forms.Button hideButton;


private System.Windows.Forms.TextBox dataTextBox;
private System.Windows.Forms.Button extractButton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem
fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
imageToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem
textToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem
saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
imageToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
textToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
aboutToolStripMenuItem;
private System.Windows.Forms.CheckBox encryptCheckBox;
private System.Windows.Forms.TextBox passwordTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label notesLabel;
private System.Windows.Forms.PictureBox imagePictureBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
}
}

SteganographyHelper.cs
using System;
using System.Drawing;

namespace Steganography
{
class SteganographyHelper
{
public enum State
{
Hiding,
Filling_With_Zeros
};

public static Bitmap embedText(string text, Bitmap bmp)


{
// initially, we'll be hiding characters in the image
State state = State.Hiding;

// holds the index of the character that is being hidden


int charIndex = 0;

// holds the value of the character converted to integer


int charValue = 0;

// holds the index of the color element (R or G or B) that


is currently being processed
long pixelElementIndex = 0;

// holds the number of trailing zeros that have been added when
finishing the process
int zeros = 0;

// hold pixel elements


int R = 0, G = 0, B = 0;

// pass through the rows


for (int i = 0; i < bmp.Height; i++)
{
// pass through each row
for (int j = 0; j < bmp.Width; j++)
{
// holds the pixel that is currently being processed
Color pixel = bmp.GetPixel(j, i);

// now, clear the least significant bit (LSB) from each pixel
element
R = pixel.R - pixel.R % 2;
G = pixel.G - pixel.G %
2; B = pixel.B - pixel.B %
2;

// for each pixel, pass through its elements (RGB)


for (int n = 0; n < 3; n++)
{
// check if new 8 bits has been processed
if (pixelElementIndex % 8 == 0)
{
// check if the whole process has finished
// we can say that it's finished when 8 zeros are
added if (state == State.Filling_With_Zeros && zeros
== 8)
{
// apply the last pixel on the image
// even if only a part of its elements have been
affected
if ((pixelElementIndex - 1) % 3 < 2)
{
bmp.SetPixel(j, i, Color.FromArgb(R, G, B));
}

// return the bitmap with the text hidden in


return bmp;
}

// check if all characters has been hidden


if (charIndex >= text.Length)
{
// start adding zeros to mark the end of the text
state = State.Filling_With_Zeros;
}
else
{
// move to the next character and process again
charValue = text[charIndex++];
}
}

// check which pixel element has the turn to hide a bit in


its LSB
switch (pixelElementIndex % 3)
{
case 0:
{
if (state == State.Hiding)
{
// the rightmost bit in the character will be
(charValue % 2)
// to put this value instead of the LSB of the
pixel element
// just add it to it
// recall that the LSB of the pixel element had
been cleared
// before this operation
R += charValue % 2;
// removes the added rightmost bit of the
character
// such that next time we can reach the next
one
charValue /= 2;
}
} break;
case 1:
{
if (state == State.Hiding)
{
G += charValue % 2;

charValue /= 2;
}
} break;
case 2:
{
if (state == State.Hiding)
{
B += charValue % 2;

charValue /= 2;
}

bmp.SetPixel(j, i, Color.FromArgb(R, G, B));


} break;
}

pixelElementIndex++;

if (state == State.Filling_With_Zeros)
{
// increment the value of zeros until it is 8
zeros++;
}
}
}
}

return bmp;
}

public static string extractText(Bitmap bmp)


{
int colorUnitIndex = 0;
int charValue = 0;

// holds the text that will be extracted from the


image string extractedText = String.Empty;

// pass through the rows


for (int i = 0; i < bmp.Height; i++)
{
// pass through each row
for (int j = 0; j < bmp.Width; j++)
{
Color pixel = bmp.GetPixel(j, i);

// for each pixel, pass through its elements (RGB)


for (int n = 0; n < 3; n++)
{
switch (colorUnitIndex % 3)
{
case 0:
{
// get the LSB from the pixel element (will be
pixel.R % 2)
// then add one bit to the right of the current
character
// this can be done by (charValue = charValue * 2)
// replace the added bit (which value is by default
0) with
// the LSB of the pixel element, simply by addition
charValue = charValue * 2 + pixel.R % 2;
} break;
case 1:
{
charValue = charValue * 2 + pixel.G % 2;
} break;
case 2:
{
charValue = charValue * 2 + pixel.B % 2;
} break;
}

colorUnitIndex++;

// if 8 bits has been added, then add the current character


to the result text
if (colorUnitIndex % 8 == 0)
{
// reverse? of course, since each time the process
happens on the right (for simplicity)
charValue = reverseBits(charValue);

// can only be 0 if it is the stop character (the 8 zeros)


if (charValue == 0)
{
return extractedText;
}

// convert the character value from int to char


char c = (char)charValue;

// add the current character to the result text


extractedText += c.ToString();
}
}
}
}

return extractedText;
}

public static int reverseBits(int n)


{
int result = 0;

for (int i = 0; i < 8; i++)


{
result = result * 2 + n %

2; n /= 2;
}

return result;
}
}
}

Annexure
Bibliography
Websites
Following websites are referring to create this project reports.

 http://www.asp.net
 http://www.asp123.com
 http://www.wikipedia.org

Books
Following books and ebook are used to complete this project
reports.

 Mastering C# (Paperback)
 .NET Black Book (Paperback)
 Professional C#, 2nd Edition (Paperback)
 Professional ASP.NET (Paperback)
 MCAD/MCSD Self-Paced Training Kit: Developing Web
Applications with Microsoft® Visual Basic® .NET and
Microsoft Visual C#® .NET, Second Edition

Appendix

KEYWORDS AND DEFINITIONS

Steganography: The art and science of hidden writing.


Cryptography : The science of writing in secret codes. Cover
Medium: file in which we will hide the hidden_data
Plain Text : Data to be hidden.
Cipher Text : The encrypted data to be hidden.
Stego Key : Data is hidden by using this string Stego
Medium : The final resultant file after hiding data. Bit Stream :
The binary code generated from the string.

You might also like