Project Report Steganography
Project Report Steganography
Project Report Steganography
SUBMITTED BY
[Student Name]
[Seat No.]
DATE OF SUBMISSION
PROJECT CERTIFICATE
This
is
to
certify
that
the
________________________________________by
Project
titled
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
Faculty in Charge
(IDOL)
Guided By
Signature
External Examiner
Examined By
Coordinator M.C.A
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
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.
Now in todays 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.
Objective:
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.
For an 8 bit image, the least significant bit i.e., the 8 th 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.
c. Parity Coding
d. Spread Sprectrum
Encryption Process
IMAGE FILE
INFORMATION FILE
BMP FILE
Decryption Process
BMP FILE
INFORMATION FILE
IMAGE FILE
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
Languages
C#.Net
Hardware Environment
Processor
@ 1.70 GHz
RAM
8 GB
Hard Disk
250 GB
Mother Board
Mouse
Key Board
Conclusion:-
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)
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
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
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.
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.
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.
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
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:
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:
Steganography vs Cryptography:
Basically, the purpose of cryptography and steganography is to provide secret
communication.
However,
steganography
is
not
the
same
as
cryptography.
.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
10010110
10011111
00001101 11001001
00001111 11001010
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
10010111
00001100
00001110
11001001
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
Joint Photographic Experts Group
Portable Network Graphics
Tagged Image File Format
Windows Meta Files
(.bmp)
(.jpg)
(.png)
(.tif)
(.wmf)
Size(Bytes)
2
4
1
1
4
2
2
1
1
2
2
2
2
2
2
Size(Bytes)
1
1
1
1
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 Header
Data
Size(Bytes)
Header Name(RIFF)
File Size
Format Name(wave)
Key Word(fmt)
Channels(Mono = 1, Stereo = 2)
Frequency
Bit Resolution
12
Wave Data
Data
Sound Length
Frequency
Sample Data
Size(Bytes)
1
1
Rest Of Wave File
Increased time
Low accuracy
Increased uncertainty
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.
2.
3.
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
COVER MEDIUM
PLAIN TEXT OR
TEXT FILE
(Text to be Hidden)
STEGNO
KEY
STEGNO-ENCODING
TOOL
STEGNO
MEDIUM
STEGNO-DECODING
TOOL
STEGNO
KEY
PLAIN
TEXT
Vigenere
Cipher
Encripted
Text
Conversion
into ASCII
form
Arithmetic
coding
Key
Information
Conversion
into 8-bit
form
Bit
Stream
Using Key
Information Encode
Bit Stream in the
Bit/Byte Stream of
Cover Medium
COVER
MEDIUM
Read the Image in
RGB values of
pixel in Bit form
Resultant
Bit/ Byte Stream
STEGNO
MEDIUM
DECODING
STEGNO
KEY
Arithmetic
coding
Key
Information
Using Key
Information
Decode Bit
Stream in the
Bit/Byte Stream
STEGNO
MEDIUM
Read the Image in
RGB values of
pixel in Bit form
Bit Stream of
Hidden Text
Conversion
into 8-bit
form
Vigenere
Cipher
ORIGINAL
TEXT
Encripted
Text
Conversion
into ASCII
Form
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.
STEP 2.
STEP 3.
If (Bit_stream[i]==1) audio_stream[i]=audio_stream[i] OR
00000001;
STEP 2.
STEP 3.
}
// from Audio file
STEP 2.
STEP 3.
for(int i=1;i<8n;i++)
{
Bit_stream[i]=least significant digit of audio_stream[i];
}
STEP 4.
Vigenere Cipher
Operating System
Window XP
Development Environment
MS Visual
C#.Net
Languages
Hardware Environment
Processor
Intel
RAM
8 GB
Hard Disk
250 GB
Mother Board
Intel
Logitech
104
chipset board
Mouse
optical mouse
Key Board
keys
keyboard
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.
.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,
any one. The mention below are list describes the benefits of
common language runtime:
Cross-language debugging
XCOPY deployment
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.
Note
Code written using a .NET language is known as managed code.
Code that uses anything but the common language runtime is
.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
Namespace
Description
involved in component creation and
containment, such as attributes, type
converters, and license providers.
System.Data
System.Data. Common
System.Data.OleDb
System.Data.SQLClient
System.Drawing
System.IO
System.Math
System.Reflection
Namespace
Description
obtaining information and dynamic
creation of types at runtime.
System.Security
System.Threading
System.Windows.Forms
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
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.
FUNCTIONS
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.
Operational Documentation
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 organizations computer based systems to
be able to judge the relevance of each proposed change.
System Testing
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 products 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
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.
different types of testing are performed.
Thus
Source Code
Program.cs
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
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
using
using
using
using
System;
System.Drawing;
System.Windows.Forms;
System.Drawing.Imaging;
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);
}
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);
}
}
{
SaveFileDialog save_dialog = new SaveFileDialog();
save_dialog.Filter = "Text Files|*.txt";
if (save_dialog.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(save_dialog.FileName, dataTextBox.Text);
}
{
OpenFileDialog open_dialog = new OpenFileDialog();
open_dialog.Filter = "Text Files|*.txt";
if (open_dialog.ShowDialog() == DialogResult.OK)
{
dataTextBox.Text = File.ReadAllText(open_dialog.FileName);
}
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
affected
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
if ((pixelElementIndex - 1) % 3 < 2)
{
bmp.SetPixel(j, i, Color.FromArgb(R, G, B));
}
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;
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)
character
0) with
// the LSB of
charValue =
} break;
case 1:
{
charValue =
} break;
case 2:
{
charValue =
} break;
charValue * 2 + pixel.G % 2;
charValue * 2 + pixel.B % 2;
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)
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
Stego Medium : The final resultant file after hiding data. Bit
Stream : The binary code generated from the string.