87
CHAPTER 1 INTRODUCTION 1.1 Steganography One of the reasons that intruders can be successful is the most of the information they acquire from a system is in a form that they can read and comprehend. Intruders may reveal the information to others, modify it to misrepresent an individual or organization, or use it to launch an attack. One solution to this problem is, through the use of steganography. Steganography is a technique of hiding information in digital media. [9] In contrast to cryptography, it is not to keep others from knowing the hidden information but it is to keep others from thinking that the information even exists. Steganography become more important as more people join the cyberspace revolution. Steganography is the art of concealing information in ways that prevents the detection of hidden messages. Stegranography include an array of secret communication methods that hide the message from being seen or discovered. The security of information has become a fundamental issue. Besides cryptography, streganography can be employed to secure information. In cryptography, the message or encrypted message is 1

Steganography Engineering project report

Embed Size (px)

Citation preview

Page 1: Steganography Engineering project report

CHAPTER 1

INTRODUCTION

1.1 Steganography

One of the reasons that intruders can be successful is the most of the information they acquire

from a system is in a form that they can read and comprehend. Intruders may reveal the information to

others, modify it to misrepresent an individual or organization, or use it to launch an attack. One

solution to this problem is, through the use of steganography. Steganography is a technique of hiding

information in digital media.[9] In contrast to cryptography, it is not to keep others from knowing the

hidden information but it is to keep others from thinking that the information even exists.

Steganography become more important as more people join the cyberspace revolution.

Steganography is the art of concealing information in ways that prevents the detection of hidden

messages. Stegranography include an array of secret communication methods that hide the message

from being seen or discovered.

The security of information has become a fundamental issue. Besides cryptography,

streganography can be employed to secure information. In cryptography, the message or encrypted

message is embedded in a digital host before passing it through the network, thus the existence of the

message is unknown. Besides hiding data for confidentiality, this approach of information hiding can

be extended to copyright protection for digital media: audio, video and images.

The growing possibilities of modern communications need the special means of security

especially on computer network. The network security is becoming more important as the number of

data being exchanged on the internet increases. Therefore, the confidentiality and data integrity are

required to protect against unauthorized access and use. This has resulted in an explosive growth of

the field of information hiding.

1

Page 2: Steganography Engineering project report

Information hiding is an emerging research area, which encompasses applications such as

copyright protection for digital media, watermarking, fingerprinting, and steganography.[2]

In watermarking applications, the message contains information such as owner identification

and a digital time stamp, which usually applied for copyright protection.

Fingerprint, the owner of the data set embeds a serial number that uniquely identifies the user

of the data set. This adds to copyright information to makes it possible to trace any unauthorized used

of the data set back to the user.

Steganography hide the secrete message within the host data set and presence imperceptible

and is to be reliably communicated to a receiver. The host data set is purposely corrupted, but in a

covert way, designed to be invisible to an information analysis.

What is Steganography?

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.[9] 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.

2

Page 3: Steganography Engineering project report

1.2 Objective

To develop a system to improve the LSB scheme , to explore techniques of hiding data using

encryption module and to extract techniques of getting secret data using decryption module.

1.3 Overview

The word steganography comes from the Greek “Steganos”, 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 secret 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.[9] 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.

3

Page 4: Steganography Engineering project report

Basically, the model for steganography is shown on following figure:

Fig 1.1: Model for Steganography

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.[6] The cover-object with the secretly embedded message is then called the Stego-object.

Recovering message from a stego-object requires the cover-object itself 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.

4

Cover-object, C

Message, M

Stego-key, K

F(X,M,K)Stego Object,

Z

Page 5: Steganography Engineering project report

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.

1.4 BENEFITS OF STEGANOGRAPHY

5

Page 6: Steganography Engineering project report

It does not attract attention: Encrypting a message gives away that there is something of value and this will attract unwanted attention.

Packet sniffing barrier: Encrypted PGP email messages start with a line identifying them as an encrypted PGP message, making it easy for a packet sniffer on an ISP to flag encrypted PGP emails by just scanning for the word PGP or GnuPG, this can not be used against steganography.[6]

Makes Internet surveillance difficult: If someone’s Internet activities are being monitored visiting Flickr and uploading personal family photos with hidden messages will not trigger any alarm but sending encrypted messages and visiting a political discussion forum will.

Difficult to prove it exists: In some countries like the United Kingdom you can be required by the police to provide the password to your encrypted files, refusing to do so carries a prison sentence, if the data has been hidden inside a photograph the police would first have to show beyond reasonable doubt that there is definitely something hidden inside the file.

Can be used with different format: Can be applied differently in simple text , digital

image ,audio and video files.

Better than cryptography: The advantage of steganography, over cryptography alone, is that

messages do not attract attention to themselves.

CHAPTER 2

THEORITICAL BACKGROUND

6

Page 7: Steganography Engineering project report

2.1 History of Steganography:

Througout 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.

3. Another method used in Greece was where someone would peel wax off a tablet that was

covered in wax, write a message underneath the wax then re-apply the wax. The recipient of the

message would simply remove the wax from the table to view the message.

7

Page 8: Steganography Engineering project report

Fig2.2: Old Technique

Carrier File refers to a file which has hidden information inside of it. Steganalysis means the process of detecting hidden information inside of a file.[8] Stego-Medium is the medium in which the information is hidden. Redundant Bits are piece of information inside a file which can be “overwritten (or) altered” without damaging the file and payload said to be the information which is concealed.

Modern Terminology

Fig2.3: Modern technique

8

Page 9: Steganography Engineering project report

2.2 STEGANOGRAPHIC TECHNIQUES

Over the past few years, numerous steganography techniques that embed hidden messages in

multimedia objects have been proposed. There have been many techniques for hiding information or

messages in images in such a manner that alteration made to the image is perceptually indiscernible.

Commonly approaches are include LSB, masking and filtering and Transform techniques.

Least significant bit (LSB) insertion is a simple approach to embedding information in image

file. The simplest steganography techniques embed the bits of the message directly into least

significant bit plane of the cover-image in a deterministic sequence. Modulating the least significant

bit does not result in human perceptible difference because the amplitude of the change is small. In

this technique, the embedding capacity can be increased by using two or more least significant bits. At

the same time, not only the risk of making the embedded message statistically detectable increase but

also the image fidelity degrades.[4] Hence a variable size LSB embedding schema is presented, in

which the number of LSBs used for message embedding/extracting depends on the local

characteristics of the pixel. The advantage of LSB-based method is easy to implement and high

message pay-load.

Although LSB hides the message in such way that the humans do not perceive it, it is still

possible for the opponent to retrieve the message due to the simplicity of the technique. Therefore,

malicious people can easily try to extract the message from the beginning of the image if they are

suspicious that there exists secret information that was embedded in the image.

Therefore, a system named Secure Information Hiding System (SIHS) is proposed to improve

the LSB scheme. It overcomes the sequence-mapping problem by embedding the message into a set

of random pixels, which are scattered on the cover-image.

Masking and filtering techniques, usually restricted to 24 bits and gray scale image, hide

information by marking an image, in a manner similar to paper watermarks. [3]The technique perform

analysis of the image, thus embed the information in significant areas so that the hidden message is

more integral to cover image than just hiding it in the noise level.

9

Page 10: Steganography Engineering project report

Transform techniques embed the message by modulating coefficient in a transform domain,

such as the Discrete Fourier Transform, or Wavelet Transform. These methods hide messages in

significant areas of the cover image, which make them more robust to attack. Transformations can be

applied over the entire image, to block throughout the image, or other variant.

TEXT STEGANOGRAPHY

Steganography in text files can be accomplished through various techniques:--

Line-shift encoding

Word-shift encoding

Feature encoding

LINE SHIFT ENCODING:- In this type of coding, Text lines is shifted up/down.

WORD SHIFT ENCODING:- In this type of encoding, Word is shifted left to right or vice

versa.

FEATURE ENCODING:- In this type of encoding, minor changes occurs in shapes of

characters.

AUDIO STEGANOGRAPHY

Audio steganography embeds the secret message into the music files having formats.

The different methods are:

Low-bit encoding

Phase coding

Spread spectrum

10

Page 11: Steganography Engineering project report

LOW-BIT ENCODING:- In this type of coding, data was stored in the least significant bit of

images, binary data can be stored in the least significant bit of audio files.

PHASE CODING:- The phase coding method works by substituting the phase of an initial

audio segment with a reference phase that represents the data.

SPREAD SPECTRUM:- When using a spread spectrum technique, however, the encoded

data is spread across as much of the frequency spectrum as possible.

IMAGE STEGANOGRAPHY

Images are composed of dots called PIXELS.

8-bit and 24-bit per pixel image files.

Each pixel gets its own color by combining percentages of red, green and blue (RGB).

For 8bit each of these colors has value from 0 to 225.

Fig 2.3: Image steganography

11

Image of a tree with a

steganographically

hidden image.

Page 12: Steganography Engineering project report

VIDEO STEGANOGRAPHY

Video Steganography is a technique to hide any kind of files in any extension into a carrrying

video file.This steagnography is rarely used since it is difficult to implement.

ILLUSTRATION OF DIFFERENT FORMATS

Fig 2.4: Different formats

12

Page 13: Steganography Engineering project report

2.2 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. [3]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.

13

Page 14: Steganography Engineering project report

CHAPTER 3

SYSTEM ANALYSIS AND DESIGN

Steganography system requires any type of image file and the information or message that is

to be hidden. It has two modules encrypt and decrypt.

Microsoft .Net framework prepares a huge amount of tool and options for programmers that

they simples programming. One of .Net tools for pictures and images is auto-converting most types of

pictures to BMP format.[6] We used this tool in this software called “Steganography” that is written in

C#.Net language and you can use this software to hide your information in any type of pictures

without any converting its format to BMP (software converts inside it).

The algorithm used for Encryption and Decryption in this application provides using several

layers lieu of using only LSB layer of image. Writing data starts from last layer (8th or LSB layer);

because significant of this layer is least and every upper layer has doubled significant from its down

layer. So every step we go to upper layer image quality decreases and image retouching transpires.

The encrypt module is used to hide information into the image, no one can see that

information or file. This module requires any type of image and message and gives the only one

image file in destination.

The decrypt module is used to get the hidden information in an image file. It take the image

file as an output, and give two file at destination folder, one is the same image file and another is the

message file that is hidden it that.

Before encrypting file inside image we must save name and size of file in a definite place of

image. We could save file name before file information in LSB layer and save file size and file name

size in most right-down pixels of image.[9] Writing this information is needed to retrieve file from

encrypted image in decryption state.

14

Page 15: Steganography Engineering project report

The graphical representation of this system is as follows:

Fig 3.1: Graphical representation of system

3.1 Why This Steganography?

This technique is chosen, because this system includes not only imperceptibility but also

undetectability by any steganalysis tool. Furthermore, it is the improved version of other simple

steganography with less limitations.

15

Start Application

Encryption Decryption

Image file

BMP image file

Image Message file

Page 16: Steganography Engineering project report

3.2 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.[2] 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 secret information is hiding in with any type of image file.

Decryption is getting the secret information from image file.

3.3 Software Requirements:

.NET Framework 3.5 Microsoft Visual studio 2010 or other version.

Operating System: Windows Operating System.

Back end: VB.NET

Front end: C#

3.4 Hardware Requirements:

Processor: Preferably 1.0 GHz or higher. RAM: 512 MB or more.

Storage Capacity: 12 GB

16

Page 17: Steganography Engineering project report

3.5 Problem Statement:

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 simply and user friendly.

3.6 Detecting Steganography:

The art of detecting Steganography is referred to as Steganalysis.

To put is simply Steganalysis involves detecting the use of Steganography inside of a file.

Steganalysis does not deal with trying to decrypt the hidden information inside of a file, just

discovering it.

There are many methods that can be used to detect Steganography such as:

17

Page 18: Steganography Engineering project report

“Viewing the file and comparing it to another copy of the file found on the Internet (Picture

file). There are usually multiple copies of images on the internet, so you may want to look for several

of them and try and compare the suspect file to them.[6] For example if you download a JPEG file and

your suspect file is also a JPEG and the two files look almost identical apart from the fact that one is

larger than the other, it is most probable you suspect file has hidden information inside of it.

3.7 Bitmap Steganography:

Bitmap type is the simplest type of picture because that it doesn’t have any technology for

decreasing file size. Structure of these files is that a bitmap image created from pixels that any pixel

created from three colors ( red, green and blue said RGB) each color of a pixel is one byte information

that shows the density of that color. Merging these three color makes every color that we see in these

pictures.[2] We know that every byte in computer science is created from 8 bit that first bit is Most-

Significant-Bit (MSB) and last bit Least-Significant-Bit (LSB), the idea of using Steganography

science is in this place; we use LSB bit for writing our security information inside BMP pictures. So if

we just use last layer (8th layer) of information, we should change the last bit of pixels, in other hands

we have 3 bits in each pixel so we have 3*height*width bits memory to write our information. But

before writing our data we must write name of data (file), size of name of data & size of data. We can

do this by assigning some first bits of memory (8th layer).

(00101101 00011101 11011100)

(10100110 11000101 00001100)

(11010010 10101100 01100011)

Using each 3 pixel of picture to save a byte of data.

18

Page 19: Steganography Engineering project report

Image Steganography and bitmap pictures:

Using bitmap pictures for hiding secret information is one of most popular choices for

Steganography. Many types of software built for this purpose, some of these software use password

protection to encrypting information on picture. To use these software you must have a ‘BMP’ format

of a pictures to use it, but using other type of pictures like “JPEG”, “GIF” or any other types is rather

or never used, because of algorithm of “BMP” pictures for Steganography is simple. Also we know

that in the web most popular of image types are “JPEG” and other types not “BPM”, so we should

have a solution for this problem.[5] This software provide the solution of this problem, it can accept

any type of image to hide information file, but finally it give the only “BMP” image as an output that

has hidden file inside it.

3.8 Encryption Process

IMAGE FILE INFORMATION FILE

BMP FILE

19

Page 20: Steganography Engineering project report

Fig 3.2: Encryption Process

3.9 Decryption Process

BMP FILE

INFORMATION FILE IMAGE FILE

20

Page 21: Steganography Engineering project report

Fig 3.3: Decryption Process

21

Page 22: Steganography Engineering project report

Fig: 3.4 USE CASE DIAGRAM

CHAPTER 4

VISUAL STUDIO OVERVIEW

Microsoft Visual Studio

Screenshot of Visual Studio 2012, editing a program's source code in VisualBasic.NET

Developer(s) Microsoft

Stable release Visual Studio 2013 Update 2 (12.0.30501.00) (May 12, 2014)

Preview release Visual Studio 2013 Update 2 RC (12.0.30110.00) (March 28, 2014)

Written in C++ and C#

Operating system

Microsoft Windows

Available inChinese, English, French, Portuguese, German, Italian, Japanese, Korean, Spanish and Russian

Type Integrated development environment

LicenseProprietary softwareExpress edition: RegisterwareOther editions: Trialware

22

Page 23: Steganography Engineering project report

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows superfamily of operating systems, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Visual Studio includes a code editor supporting IntelliSense as well as code refactoring. The integrated debugger works both as a source-level debugger and a machine-level debugger. Other built-in tools include a forms designer for building GUI applications, web designer, class designer, and database schema designer. It accepts plug-ins that enhance the functionality at almost every level—including adding support for source-control systems (like Subversion) and adding new toolsets like editors and visual designers for domain-specific languages or toolsets for other aspects of the software development lifecycle (like the Team Foundation Server client: Team Explorer).

Visual Studio supports different programming languages and allows the code editor and debugger to support (to varying degrees) nearly any programming language, provided a language-specific service exists. Built-in languages include C, C++ and C++/CLI (via Visual C++), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio 2010). Support for other languages such as M, Python, and Ruby among others is available via language services installed separately. It also supports XML/XSLT, HTML/XHTML, JavaScript and CSS.

Microsoft provides "Express" editions of its Visual Studio at no cost. Commercial versions of Visual Studio along with select past versions are available for free to students via Microsoft's DreamSpark program.

Architecture

Visual Studio does not support any programming language, solution or tool intrinsically, instead it allows the plugging of functionality coded as a VSPackage. When installed, the functionality is available as a Service. The IDE provides three services: SVsSolution, which provides the ability to enumerate projects and solutions; SVsUIShell, which provides windowing and UI functionality (including tabs, toolbars and tool windows); and SVsShell, which deals with registration of VSPackages. In addition, the IDE is also responsible for coordinating and enabling communication between services. All editors, designers, project types and other tools are implemented as VSPackages. Visual Studio uses COM to access the VSPackages. The Visual Studio SDK also includes the Managed Package Framework (MPF), which is a set of managed wrappers around the COM-interfaces that allow the Packages to be written in any CLI compliant language. However, MPF does not provide all the functionality exposed by the Visual Studio COM interfaces. The services can then be consumed for creation of other packages, which add functionality to the Visual Studio IDE.

23

Page 24: Steganography Engineering project report

Support for programming languages is added by using a specific VSPackage called a Language Service. A language service defines various interfaces which the VSPackage implementation can implement to add support for various functionalities. Functionalities that can be added this way include syntax coloring, statement completion, brace matching, parameter information tooltips, member lists and error markers for background compilation. If the interface is implemented, the functionality will be available for the language. Language services are to be implemented on a per-language basis. The implementations can reuse code from the parser or the compiler for the language. Language services can be implemented either in native code or managed code. For native code, either the native COM interfaces or the Babel Framework (part of Visual Studio SDK) can be used. For managed code, the MPF includes wrappers for writing managed language services.

Visual Studio does not include any source control support built in but it defines two alternative ways for source control systems to integrate with the IDE. A Source Control VSPackage can provide its own customised user interface. In contrast, a source control plugin using the MSSCCI (Microsoft Source Code Control Interface) provides a set of functions that are used to implement various source control functionality, with a standard Visual Studio user interface. MSSCCI was first used to integrate Visual SourceSafe with Visual Studio 6.0 but was later opened up via the Visual Studio SDK. Visual Studio .NET 2002 used MSSCCI 1.1, and Visual Studio .NET 2003 used MSSCCI 1.2. Visual Studio 2005, 2008 and 2010 use MSSCCI Version 1.3, which adds support for rename and delete propagation as well as asynchronous opening.

Visual Studio supports running multiple instances of the environment (each with its own set of VSPackages). The instances use different registry hives (see MSDN's definition of the term "registry hive" in the sense used here) to store their configuration state and are differentiated by their AppId (Application ID). The instances are launched by an AppId-specific .exe that selects the AppId, sets the root hive and launches the IDE. VSPackages registered for one AppId are integrated with other VSPackages for that AppId. The various product editions of Visual Studio are created using the different AppIds. The Visual Studio Express edition products are installed with their own AppIds, but the Standard, Professional and Team Suite products share the same AppId. Consequently, one can install the Express editions side-by-side with other editions, unlike the other editions which update the same installation. The professional edition includes a superset of the VSPackages in the standard edition and the team suite includes a superset of the VSPackages in both other editions. The AppId system is leveraged by the Visual Studio Shell in Visual Studio 2008.

Features

Code editor

Like any other IDE, it includes a code editor that supports syntax highlighting and code completion using IntelliSense for not only variables, functions and methods but also language constructs like loops and queries. IntelliSense is supported for the included languages, as well as for XML and for Cascading Style Sheets and JavaScript when developing web sites and web applications. Autocomplete suggestions are popped up in a modeless list box, overlaid on top of the code editor. In Visual Studio 2008 onwards, it can be made temporarily semi-transparent to see the code obstructed by it. The code editor is used for all supported languages.

24

Page 25: Steganography Engineering project report

The Visual Studio code editor also supports setting bookmarks in code for quick navigation. Other navigational aids include collapsing code blocks and incremental search, in addition to normal text search and regex search. The code editor also includes a multi-item clipboard and a task list. The code editor supports code snippets, which are saved templates for repetitive code and can be inserted into code and customized for the project being worked on. A management tool for code snippets is built in as well. These tools are surfaced as floating windows which can be set to automatically hide when unused or docked to the side of the screen. The Visual Studio code editor also supports code refactoring including parameter reordering, variable and method renaming, interface extraction and encapsulation of class members inside properties, among others.

Visual Studio features background compilation (also called incremental compilation). As code is being written, Visual Studio compiles it in the background in order to provide feedback about syntax and compilation errors, which are flagged with a red wavy underline. Warnings are marked with a green underline. Background compilation does not generate executable code, since it requires a different compiler than the one used to generate executable code. Background compilation was initially introduced with Microsoft Visual Basic but has now been expanded for all included languages.

Debugger

Visual Studio includes a debugger that works both as a source-level debugger and as a machine-level debugger. It works with both managed code as well as native code and can be used for debugging applications written in any language supported by Visual Studio. In addition, it can also attach to running processes and monitor and debug those processes. If source code for the running process is available, it displays the code as it is being run. If source code is not available, it can show the disassembly. The Visual Studio debugger can also create memory dumps as well as load them later for debugging. Multi-threaded programs are also supported. The debugger can be configured to be launched when an application running outside the Visual Studio environment crashes.

The debugger allows setting breakpoints (which allow execution to be stopped temporarily at a certain position) and watches (which monitor the values of variables as the execution progresses). Breakpoints can be conditional, meaning they get triggered when the condition is met. Code can be stepped over, i.e., run one line (of source code) at a time. It can either step into functions to debug inside it, or step over it, i.e., the execution of the function body isn't available for manual inspection. The debugger supports Edit and Continue, i.e., it allows code to be edited as it is being debugged (32 bit only; not supported in 64 bit). When debugging, if the mouse pointer hovers over any variable, its current value is displayed in a tooltip ("data tooltips"), where it can also be modified if desired. During coding, the Visual Studio debugger lets certain functions be invoked manually from the Immediate tool window. The parameters to the method are supplied at the Immediate window.

25

Page 26: Steganography Engineering project report

Designer

Visual Studio Web Designer in code editor view

Visual Studio 2005 in Class Designer view

Visual Studio includes a host of visual designers to aid in the development of applications. These tools include:

Windows Forms Designer

The Windows Forms designer is used to build GUI applications using Windows Forms. Layout can be controlled by housing the controls inside other containers or locking them to the side of the form. Controls that display data (like textbox, list box, grid view, etc.) can be bound to data sources like databases or queries. Data-bound controls can be created by dragging items from the Data Sources window onto a design surface. The UI is linked with code using an event-driven programming model. The designer generates either C# or VB.NET code for the application.

WPF Designer

The WPF designer, codenamed Cider, was introduced with Visual Studio 2008. Like the Windows Forms designer it supports the drag and drop metaphor. It is used to author user interfaces

26

Page 27: Steganography Engineering project report

targeting Windows Presentation Foundation. It supports all WPF functionality including data binding and automatic layout management. It generates XAML code for the UI. The generated XAML file is compatible with Microsoft Expression Design, the designer-oriented product. The XAML code is linked with code using a code-behind model.

Web designer/development

Visual Studio also includes a web-site editor and designer that allows web pages to be authored by dragging and dropping widgets. It is used for developing ASP.NET applications and supports HTML, CSS and JavaScript. It uses a code-behind model to link with ASP.NET code. From Visual Studio 2008 onwards, the layout engine used by the web designer is shared with Microsoft Expression Web. There is also ASP.NET MVC support for MVC technology as a separate download and ASP.NET Dynamic Data project available from Microsoft.

Class designer

The Class Designer is used to author and edit the classes (including its members and their access) using UML modeling. The Class Designer can generate C# and VB.NET code outlines for the classes and methods. It can also generate class diagrams from hand-written classes.

Data designer

The data designer can be used to graphically edit database schemas, including typed tables, primary and foreign keys and constraints. It can also be used to design queries from the graphical view.

Mapping designer

From Visual Studio 2008 onwards, the mapping designer is used by LINQ to SQL to design the mapping between database schemas and the classes that encapsulate the data. The new solution from ORM approach, ADO.NET Entity Framework, replaces and improves the old technology.

Open Tabs Browser

The open tabs browser is used to list all open tabs and to switch between them. It is invoked using CTRL+TAB.

Properties Editor

The Properties Editor tool is used to edit properties in a GUI pane inside Visual Studio. It lists all available properties (both read-only and those which can be set) for all objects including classes, forms, web pages and other items.

27

Page 28: Steganography Engineering project report

Object Browser

The Object Browser is a namespace and class library browser for Microsoft .NET. It can be used to browse the namespaces (which are arranged hierarchically) in managed assemblies. The hierarchy may or may not reflect the organization in the file system.

Solution Explorer

In Visual Studio parlance, a solution is a set of code files and other resources that are used to build an application. The files in a solution are arranged hierarchically, which might or might not reflect the organization in the file system. The Solution Explorer is used to manage and browse the files in a solution.

Team Explorer

Team Explorer is used to integrate the capabilities of Team Foundation Server, the Revision Control System into the IDE (and the basis for Microsoft's CodePlex hosting environment for open source projects). In addition to source control it provides the ability to view and manage individual work items (including bugs, tasks and other documents) and to browse TFS statistics. It is included as part of a TFS install and is also available as a download for Visual Studio separately. Team Explorer is also available as a stand-alone environment solely to access TFS services.

Data Explorer

Data Explorer is used to manage databases on Microsoft SQL Server instances. It allows creation and alteration of database tables (either by issuing T-SQL commands or by using the Data designer). It can also be used to create queries and stored procedures, with the latter in either T-SQL or in managed code via SQL CLR. Debugging and IntelliSense support is available as well.

Server Explorer

The Server Explorer tool is used to manage database connections on an accessible computer. It is also used to browse running Windows Services, performance counters, Windows Event Log and message queues and use them as a datasource.

28

Page 29: Steganography Engineering project report

Dotfuscator Software Services Community Edition

Visual Studio includes a free 'light' version of PreEmptive Solutions' Dotfuscator product for code obfuscation and application-size reduction. Starting with Visual Studio 2010, this version of Dotfuscator will include Runtime Intelligence capabilities that allow authors to gather end-user usage, performance, and stability information from their applications running in production.

Text Generation Framework

Visual Studio includes a full text generation framework called T4 which enables Visual Studio to generate text files from templates either in the IDE or via code.

ASP.NET Web Site Administration Tool

The ASP.NET Web Site Administration Tool allows for the configuration of ASP.NET websites.

Visual Studio Tools for Office

Visual Studio Tools for Office is a SDK and an add-in for Visual Studio that includes tools for developing for the Microsoft Office suite. Previously (for Visual Studio .NET 2003 and Visual Studio 2005) it was a separate SKU that supported only Visual C# and Visual Basic languages or was included in the Team Suite. With Visual Studio 2008, it is no longer a separate SKU but is included with Professional and higher editions. A separate runtime is required when deploying VSTO solutions.

Extensibility

Visual Studio allows developers to write extensions for Visual Studio to extend its capabilities. These extensions "plug into" Visual Studio and extend its functionality. Extensions come in the form of macros, add-ins, and packages. Macros represent repeatable tasks and actions that developers can record programmatically for saving, replaying, and distributing. Macros, however, cannot implement new commands or create tool windows. They are written using Visual Basic and are not compiled. Add-Ins provide access to the Visual Studio object model and can interact with the IDE tools. Add-Ins can be used to implement new functionality and can add new tool windows. Add-Ins are plugged into the IDE via COM and can be created in any COM-compliant languages. Packages are created using the Visual Studio SDK and provide the highest level of extensibility. They can create designers and other tools, as well as integrate other programming languages. The Visual Studio SDK provides unmanaged APIs as well as a managed API to accomplish these tasks. However, the managed API isn't as comprehensive as the unmanaged one.Extensions are supported in

29

Page 30: Steganography Engineering project report

the Standard (and higher) versions of Visual Studio 2005. Express Editions do not support hosting extensions.

Visual Studio 2008 introduced the Visual Studio Shell that allows for development of a customized version of the IDE. The Visual Studio Shell defines a set of VSPackages that provide the functionality required in any IDE. On top of that, other packages can be added to customize the installation. The Isolated mode of the shell creates a new AppId where the packages are installed. These are to be started with a different executable. It is aimed for development of custom development environments, either for a specific language or a specific scenario. The Integrated mode installs the packages into the AppId of the Professional/Standard/Team System editions, so that the tools integrate into these editions. The Visual Studio Shell is available as a free download.

After the release of Visual Studio 2008, Microsoft created the Visual Studio Gallery. It serves as the central location for posting information about extensions to Visual Studio. Community developers as well as commercial developers can upload information about their extensions to Visual Studio .NET 2002 through Visual Studio 2010. Users of the site can rate and review the extensions to help assess the quality of extensions being posted. RSS feeds to notify users on updates to the site and tagging features are also planned.

Microsoft Visual C++

Microsoft Visual C++ is Microsoft's implementation of the C and C++ compiler and associated languages-services and specific tools for integration with the Visual Studio IDE. It can compile either in C mode or C++ mode. For C, it follows the ISO C standard with parts of C99 specification along with MS-specific additions in the form of libraries. For C++, it follows the ANSI C++ specification along with a few C++11 features. It also supports the C++/CLI specification to write managed code, as well as mixed-mode code (a mix of native and managed code). Microsoft positions Visual C++ for development in native code or in code that contains both native as well as managed components. Visual C++ supports COM as well as the MFC library. For MFC development, it provides a set of wizards for creating and customizing MFC boilerplate code, and creating GUI applications using MFC. Visual C++ can also use the Visual Studio forms designer to design UI graphically. Visual C++ can also be used with the Windows API. It also supports the use of intrinsic functions,[43] which are functions recognized by the compiler itself and not implemented as a library. Intrinsic functions are used to expose the SSE instruction set of modern CPUs. Visual C++ also includes the OpenMP (version 2.0) specification.

30

Page 31: Steganography Engineering project report

Microsoft Visual C#

Microsoft Visual C#, Microsoft's implementation of the C# language, targets the .NET Framework, along with the language services that lets the Visual Studio IDE support C# projects. While the language services are a part of Visual Studio, the compiler is available separately as a part of the .NET Framework. The Visual C# 2008, 2010 and 2012 compilers support versions 3.0, 4.0 and 5.0 of the C# language specifications, respectively. Visual C# supports the Visual Studio Class designer, Forms designer, and Data designer among others.

Microsoft Visual Basic

Microsoft Visual Basic is Microsoft's implementation of the VB.NET language and associated tools and language services. It was introduced with Visual Studio .NET (2002). Microsoft has positioned Visual Basic for Rapid Application Development. Visual Basic can be used to author both console applications as well as GUI applications. Like Visual C#, Visual Basic also supports the Visual Studio Class designer, Forms designer, and Data designer among others. Like C#, the VB.NET compiler is also available as a part of .NET Framework, but the language services that let VB.NET projects be developed with Visual Studio, are available as a part of the latter.

Microsoft Visual Web Developer

Microsoft Visual Web Developer is used to create web sites, web applications and web services using ASP.NET. Either C# or VB.NET languages can be used. Visual Web Developer can use the Visual Studio Web Designer to graphically design web page layouts.

Team Foundation Server

Included only with Visual Studio Team System, Team Foundation Server is intended for collaborative software development projects and acts as the server-side backend providing source control, data collection, reporting, and project-tracking functionality. It also includes the Team Explorer, the client tool for TFS services, which is integrated inside Visual Studio Team System. [Wikipedia]

31

Page 32: Steganography Engineering project report

CHAPTER 5: TESTING

5.1 Introduction

Tes t i ng de f ine s t he s t a tu s o f t he work i ng func t i ona l i t i e s o f any pa r t i cu l a r   system. Through testing particular software one can’t identify the defects in it but can ana l y se t he pe r fo rm ance o f s o f tw a re and i t s work i ng beha v iou r . By t e s t i ng t he s o f t w a r e w e c a n f i n d t h e l i m i t a t i o n s t h a t b e c o m e t h e c o n d i t i o n s o n w h i c h t h e  performance is measured on that particular level. [5 ] In order to start the testing process the primary thing is requirements of software development cycle. Using this phase the testing phase will be easier for testers.

The c apac i ty o f t he so f t wa re can be ca l c u l a t ed by exec u t ing t he code and inspecting the code in different conditions such as testing the software by subjecting it to different sources as input and examining the results with respect to the inputs.

After the designing phase, the next phase is to develop and execute the code indifferent conditions for any errors and progress to the developing phase. Without testing and execution, the software cannot be moved to the developing phase.

T h e r e a r e t w o t y p e s o f t e s t i n g . T h e functional testing, wh i ch de f ine s t he specified function of a particular code in the program. This type of testing gives us a  b r i e f de s c r ip t i on abou t t he p rog ram ’s pe r fo rmance and s ecu r i t y i n t he va r ious functional areas.

T h e o t h e r t y p e o f t e s t i n g i s non-functional testing. Non-functional testing defines the capabilities of particular software like its log data etc. It is opposite to func t i ona l t e s t i ng and s o w i l l no t de s c r i be t he s pec i f i c a t i ons l i ke s ecu r i t y and  performance.

The pe r fo rma nce o f t he pa r t i cu l a r p rog ram no t on l y de pends on e r ro r s i n coding.[1] The errors in the code can be noticed during execution, but the other types of errors can affect the program performance like when the program is developed based on one platform that may not perform well and give errors when executed in different platform. So, compatibility is another issue that reduce the software performance. The code tuning helps us in optimising the program to perform at its best utilizing minimal resources possible under varied conditions.

32

Page 33: Steganography Engineering project report

5.2 TEST CASES

Tests have been performed throughout the implementation of the application. When t he t e s t s have found an e r ro r , t he p rob lem was found and r e so l ved . The following tests cases were done after the system was “completed”.

5.2.1 Startup Screen Display

Test # Description Expected Outcome

As Expected

5.3.1.1 Open The software

The software will be loaded up as intended. There are no glitches or anomalies.

Yes

5.3.1.2 Action > Encrypt Image

The encryption screen will appear and the option to select an image will appear.

Yes

5.3.1.3 Action > Decrypt Image

The decryption screen will appear and the option to select an image will appear.

Yes

5.3.1.4 Action>Browse A dialogue box will appear to select the image from system.

Yes

5.3.1.5Action>close The software

will be closed.Yes

33

Page 34: Steganography Engineering project report

5.3.1.6 Action>Encrypt (If no image is loaded first)

A dialogue box will appear showing error,encryption information is incomplete.

No

34

Page 35: Steganography Engineering project report

5.3.1.7 Action>Decrypt (If no image is loaded first)

A dialogue box will appear showing error, text boxes must not be empty.

No

5.2.2 For Encryption

Test # Description Expected Outcome

As Expected

5.2.2.1 Select the image from the hard drive by clicking the browse.

Image will be selected if there are no errors while selecting. In case of any error an appropriate pop up will be displayed.

Yes

5.2.2.2

Click on the “Perform the Steganography”

Operations will be performed.

Yes

5.2.2.3 View the Image in a different window

The image will be displayed in a different window if steganography

Yes

35

Page 36: Steganography Engineering project report

has been successfully performed on it.

5.2.3 For Decryption

Test # Description Expected Outcome

As Expected

5.2.3.1 Select an Image File for Decryption

Image will be selected if no errors while selecting. In case of any error a window will be displayed.

Yes

5.2.3.2

5.2.3.3

User clicks the ‘Save ’ button

Click on the decrypt button

Option to save file will appear.

The decryption screen will appear and the option to select an image will

Yes

Yes

36

Page 37: Steganography Engineering project report

appear5.2.3.4 Action>Decrypt Window will

appear to save the decrypted file

Yes

CHAPTER 6

LIMITATIONS AND FUTURE ENHANCEMENT

37

Page 38: Steganography Engineering project report

6.1 Limitations of the Software:

This project has an assumption that is both the sender and receiver must have shared some

secret information before imprisonment. [1]Pure steganography means that there is none prior

information shared by two communication parties.

The software does not require any encrypt or decrypt key.

It cannot hide larger files in images like HD videos (.mkv, .mp4).

Takes time to encrypt and decrypt larger files.

Hiding larger size data can degrade the quality of an image.

6.2 Future Enhancements:

To make it pure steganography application.

Due to time and computing limitations, we could not explore all facts of steganography and detection techniques. We studied the power in our pictures to test for hidden data.[5] Another method which we were unable to explore was to analyze the noise of the pictures. Adding hidden data adds random noise, so it follows that a properly tuned noise detection algorithm could recognize whether or not a picture had steganographic data or not.

Use of video formats like .mpeg, .mkv, .vob, .mp4, .3gp, etc.

Hiding something in an executable file.

6.3 Applications:

38

Page 39: Steganography Engineering project report

Usage in modern printers: 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.

Alleged use by intelligence services: In 2010, the Federal Bureau of Investigation alleged that the Russian foreign intelligence service uses customized steganography software for embedding encrypted text messages inside image files for certain communications with "illegal agents" (agents under non-diplomatic cover) stationed abroad.

Use by terrorists: Rumors about terrorists using steganography started first in the daily newspaper USA Today on 5 February 2001 in two articles titled "Terrorist instructions hidden online" and "Terror groups hide behind Web encryption". Lately, al-Qaeda operatives have been sending hundreds of encrypted messages that have been hidden in files on digital photographs on the auction site eBay.com".[3] Other media worldwide cited these rumors many times, especially after the terrorist attack of 9/11, without ever showing proof.

Distributed Steganography: There are distributed steganography methods,[8] including methodologies that distribute the payload through multiple carrier files in diverse locations to make detection more difficult. For example the U.S. Patent 8,527,779 by cryptographer William Easttom (Chuck Easttom)

Using Sudoku puzzles: This is the art of concealing data in an image using Sudoku which is used like a key to hide the data within an image. Steganography using sudoku puzzles has as many keys as there are possible solutions of a Sudoku puzzle, which is 6.71×1021. This is equivalent to around 70 bits, making it much stronger than the DES method which uses a 56 bit key.

CHAPTER 7

39

Page 40: Steganography Engineering project report

SUMMARY

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.[9] 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.

Since ancient times, man has found a desire in the ability to communicate covertly. The recent

explosion of research in watermarking to protect intellectual property is evidence that steganography

is not just limited to military or espionage applications. Steganography, like cryptography, will play

an increasing role in the future of secure communication in the “digital world”.

40

Page 41: Steganography Engineering project report

CHAPTER 8

USER MANUAL

This is the first screen which has two tab options – one is Encrypt Image for encryption and

another is Decrypt image for decryption. In right – top panel is displays the information about

the image such as size, height and width.

41

Page 42: Steganography Engineering project report

Encryption

1. For Encryption select Encrypt Image tab option.

42

Page 43: Steganography Engineering project report

2. For load image click on button “Browse” that is next to the Load Image textbox. The file

open dialog box will displays as follows, select the Image file, which you want to use hide

information and click on Open button.

43

Page 44: Steganography Engineering project report

1. The image file will opened and is displays as follows. Next, click on “Browse” button that is next to the Load File textbox.

44

Page 45: Steganography Engineering project report

2. Again the file open dialog box will appear, select any type of file whatever you want to hide with the image and click on ok button.

45

Page 46: Steganography Engineering project report

3. The next step is to encrypt the file. Now click on “Encrypt” button, it will open the save dialog box which ask you to select the path to save the New image file and the Image file name. The default format of image file is BMP.

46

Page 47: Steganography Engineering project report

47

Page 48: Steganography Engineering project report

Decryption

1. Select the Decryption Image tab option.

48

Page 49: Steganography Engineering project report

2. Next click on the “Browse” button, which open the Open file dialog box, here you have to select the image which is Encrypted and has hidden information file. Select the image file and click on Open button.

49

Page 50: Steganography Engineering project report

3. The image file displayed as follows:

50

Page 51: Steganography Engineering project report

4. Now click on “Browse” button which is next to “Save file to” textbox. It will open a dialog box that is “Browse for folder”. It ask you to select the path or folder, where you want to extract the hidden file. Select the folder and click on Ok button.

5. Now click on Decrypt button, it will decrypt the image, the hidden file and image file is saved into selected folder. The message for successful decryption is displayed on the status bar which is places at bottom of the screen.

51

Page 52: Steganography Engineering project report

52

Page 53: Steganography Engineering project report

CHAPTER 9

CONCLUSION

Though Steganography is not implemented in wider ways but it can be the best security tool.

The main problem of today’s world is to secure their data confidentially, the techniques used currently are not considered the best which can only be replaced by Steganography.

When implemented properly, steganography can be difficult to detect, but not

impossible.

Steganography detection can be used to prevent communication of malicious data.

Steganography is useful for hiding messages for transmission.  One of the major discoveries of this investigation was that each steganographic implementation carries with it significant trade-off decisions, and it is up to the steganographer to decide which implementation suits him/her best.[9] Below, advantages and disadvantages to some steganographic techniques are discussed.

Technique Advantages DisadvantagesLeast Significant Bit (LSB) Encoding

Hard to detect.  Original image is very similar to altered image.  Embedded data resembles Gaussian noise.

Message is hard to recover if image is subject to attack such as translation and rotation.

Low Frequency Encoding Hard to detect as message and fundamental image data share same range.

Significant damage to picture appearance.  Message difficult to recover.

Mid Frequency Encoding Altered picture closely resembles original.  Not susceptible to attacks such as rotation and translation.

Relatively easy to detect, as our project has shown.

Relatively easy to detect, as our project has shown.

None Image is distorted.  Message easily lost if picture subject to compression such as JPEG.

53

Page 54: Steganography Engineering project report

REFERENCES/BIBLIOGRAPHY

1.Data Hiding and Retrieval by A.Nath, S.Das, A.Chakrabarti, Proceedingsof IEEE International conference on Computer Intelligence andComputer Network held at Bhopal from 26-28 Nov, Page-392-397,2010.

2.Advanced steganographic approach for hiding encrypted secret messagein LSB ,LSB+1,LSB+2 and LSB+3 bits in non standard cover files byJoyshree Nath, Sankar Das, Shalabh Agarwal and Asoke Nath , to bepublished in IJCA(USA),Vol 14-No.7, P-31-35, February 2011.

3.Cryptography and Network by William Stallings ,Prectice Hall of India.

4. Modified Version of Playfair Cipher using Linear Feedback Shift Register by P. Murali and Gandhidoss Senthilkumar, UCSNSInternational journal of Computer Science and Network Security, Vol-8.

5.Jpeg20000 Standard for Image Compression Concepts algorithms andVLSI Architectures by Tinku Acharya and Ping-Sing Tsai, WileyInterscience.

6.Steganography and Seganalysis by Moerland, T , Leiden Institute ofAdvanced Computing Science.

7.SSB-4 System of Steganography using bit 4 by J.M.Rodrigues Et. Al.

8.An Overview of Image Steganography by T.Morkel, J.H.P. Eloff andM.S.Oliver.

9.An Overview of Steganography by Shawn D. Dickman,TMH.

54

Page 55: Steganography Engineering project report

APPENDIX A: C# CODE FOR SECRET MESSAGE HIDING USING STEGANOGRAPHY

using System;using System.Drawing;using System.Windows.Forms;using System.IO;

namespace Text2Image{ public partial class FrmSteganography : Form { public FrmSteganography() { InitializeComponent(); }

//public values: string loadedTrueImagePath, loadedFilePath, saveToImage,DLoadImagePath,DSaveFilePath; int height, width; long fileSize, fileNameSize; Image loadedTrueImage, DecryptedImage ,AfterEncryption; Bitmap loadedTrueBitmap, DecryptedBitmap; Rectangle previewImage = new Rectangle(20,160,490,470); bool canPaint = false, EncriptionDone = false; byte[] fileContainer;

private void EnImageBrowse_btn_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { loadedTrueImagePath = openFileDialog1.FileName; EnImage_tbx.Text = loadedTrueImagePath; loadedTrueImage = Image.FromFile(loadedTrueImagePath); height = loadedTrueImage.Height; width = loadedTrueImage.Width; loadedTrueBitmap = new Bitmap(loadedTrueImage);

FileInfo imginf = new FileInfo(loadedTrueImagePath); float fs = (float)imginf.Length / 1024; ImageSize_lbl.Text = smalldecimal(fs.ToString(), 2) + " KB"; ImageHeight_lbl.Text = loadedTrueImage.Height.ToString() + " Pixel"; ImageWidth_lbl.Text = loadedTrueImage.Width.ToString() + " Pixel";

55

Page 56: Steganography Engineering project report

double cansave = (8.0 * ((height * (width / 3) * 3) / 3 - 1)) / 1024; CanSave_lbl.Text = smalldecimal(cansave.ToString(), 2) + " KB";

canPaint = true; this.Invalidate(); } }

private string smalldecimal(string inp, int dec) { int i; for (i = inp.Length - 1; i > 0; i--) if (inp[i] == '.') break; try { return inp.Substring(0, i + dec + 1); } catch { return inp; } }

private void EnFileBrowse_btn_Click(object sender, EventArgs e) { if (openFileDialog2.ShowDialog() == DialogResult.OK) { loadedFilePath = openFileDialog2.FileName; EnFile_tbx.Text = loadedFilePath; FileInfo finfo = new FileInfo(loadedFilePath); fileSize = finfo.Length; fileNameSize = justFName(loadedFilePath).Length; } }

private void Encrypt_btn_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { saveToImage = saveFileDialog1.FileName; } else return; if (EnImage_tbx.Text == String.Empty || EnFile_tbx.Text == String.Empty) { MessageBox.Show("Encrypton information is incomplete!\nPlease complete them frist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (8*((height * (width/3)*3)/3 - 1) < fileSize + fileNameSize) { MessageBox.Show("File size is too large!\nPlease use a larger image to hide this file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;

56

Page 57: Steganography Engineering project report

} fileContainer = File.ReadAllBytes(loadedFilePath); EncryptLayer(); }

private void EncryptLayer() { toolStripStatusLabel1.Text ="Encrypting... Please wait"; Application.DoEvents(); long FSize = fileSize; Bitmap changedBitmap = EncryptLayer(8, loadedTrueBitmap, 0, (height * (width/3)*3) / 3 - fileNameSize - 1, true); FSize -= (height * (width / 3) * 3) / 3 - fileNameSize - 1; if(FSize > 0) { for (int i = 7; i >= 0 && FSize > 0; i--) { changedBitmap = EncryptLayer(i, changedBitmap, (((8 - i) * height * (width / 3) * 3) / 3 - fileNameSize - (8 - i)), (((9 - i) * height * (width / 3) * 3) / 3 - fileNameSize - (9 - i)), false); FSize -= (height * (width / 3) * 3) / 3 - 1; } } changedBitmap.Save(saveToImage); toolStripStatusLabel1.Text = "Encrypted image has been successfully saved."; EncriptionDone = true; AfterEncryption = Image.FromFile(saveToImage); this.Invalidate(); }

private Bitmap EncryptLayer(int layer, Bitmap inputBitmap, long startPosition, long endPosition, bool writeFileName) { Bitmap outputBitmap = inputBitmap; layer--; int i = 0, j = 0; long FNSize = 0; bool[] t = new bool[8]; bool[] rb = new bool[8]; bool[] gb = new bool[8]; bool[] bb = new bool[8]; Color pixel = new Color(); byte r, g, b;

if (writeFileName) { FNSize = fileNameSize; string fileName = justFName(loadedFilePath);

//write fileName: for (i = 0; i < height && i * (height / 3) < fileNameSize; i++) for (j = 0; j < (width / 3) * 3 && i * (height / 3) + (j / 3) < fileNameSize; j++)

57

Page 58: Steganography Engineering project report

{ byte2bool((byte)fileName[i * (height / 3) + j / 3], ref t); pixel = inputBitmap.GetPixel(j, i); r = pixel.R; g = pixel.G; b = pixel.B; byte2bool(r, ref rb); byte2bool(g, ref gb); byte2bool(b, ref bb); if (j % 3 == 0) { rb[7] = t[0]; gb[7] = t[1]; bb[7] = t[2]; } else if (j % 3 == 1) { rb[7] = t[3]; gb[7] = t[4]; bb[7] = t[5]; } else { rb[7] = t[6]; gb[7] = t[7]; } Color result = Color.FromArgb((int)bool2byte(rb), (int)bool2byte(gb), (int)bool2byte(bb)); outputBitmap.SetPixel(j, i, result); } i--; } //write file (after file name): int tempj = j;

for (; i < height && i * (height / 3) < endPosition - startPosition + FNSize && startPosition + i * (height / 3) < fileSize + FNSize; i++) for (j = 0; j < (width / 3) * 3 && i * (height / 3) + (j / 3) < endPosition - startPosition + FNSize && startPosition + i * (height / 3) + (j / 3) < fileSize + FNSize; j++) { if (tempj != 0) { j = tempj; tempj = 0; } byte2bool((byte)fileContainer[startPosition + i * (height / 3) + j / 3 - FNSize], ref t); pixel = inputBitmap.GetPixel(j, i); r = pixel.R; g = pixel.G; b = pixel.B; byte2bool(r, ref rb); byte2bool(g, ref gb); byte2bool(b, ref bb);

58

Page 59: Steganography Engineering project report

if (j % 3 == 0) { rb[layer] = t[0]; gb[layer] = t[1]; bb[layer] = t[2]; } else if (j % 3 == 1) { rb[layer] = t[3]; gb[layer] = t[4]; bb[layer] = t[5]; } else { rb[layer] = t[6]; gb[layer] = t[7]; } Color result = Color.FromArgb((int)bool2byte(rb), (int)bool2byte(gb), (int)bool2byte(bb)); outputBitmap.SetPixel(j, i, result);

} long tempFS = fileSize, tempFNS = fileNameSize; r = (byte)(tempFS % 100); tempFS /= 100; g = (byte)(tempFS % 100); tempFS /= 100; b = (byte)(tempFS % 100); Color flenColor = Color.FromArgb(r,g,b); outputBitmap.SetPixel(width - 1, height - 1, flenColor);

r = (byte)(tempFNS % 100); tempFNS /= 100; g = (byte)(tempFNS % 100); tempFNS /= 100; b = (byte)(tempFNS % 100); Color fnlenColor = Color.FromArgb(r,g,b); outputBitmap.SetPixel(width - 2, height - 1, fnlenColor);

return outputBitmap; }

private void DecryptLayer() { toolStripStatusLabel1.Text = "Decrypting... Please wait"; Application.DoEvents(); int i, j = 0; bool[] t = new bool[8]; bool[] rb = new bool[8]; bool[] gb = new bool[8]; bool[] bb = new bool[8]; Color pixel = new Color(); byte r, g, b; pixel = DecryptedBitmap.GetPixel(width - 1, height - 1); long fSize = pixel.R + pixel.G * 100 + pixel.B * 10000;

59

Page 60: Steganography Engineering project report

pixel = DecryptedBitmap.GetPixel(width - 2, height - 1); long fNameSize = pixel.R + pixel.G * 100 + pixel.B * 10000; byte[] res = new byte[fSize]; string resFName = ""; byte temp;

//Read file name: for (i = 0; i < height && i * (height / 3) < fNameSize; i++) for (j = 0; j < (width / 3) * 3 && i * (height / 3) + (j / 3) < fNameSize; j++) { pixel = DecryptedBitmap.GetPixel(j, i); r = pixel.R; g = pixel.G; b = pixel.B; byte2bool(r, ref rb); byte2bool(g, ref gb); byte2bool(b, ref bb); if (j % 3 == 0) { t[0] = rb[7]; t[1] = gb[7]; t[2] = bb[7]; } else if (j % 3 == 1) { t[3] = rb[7]; t[4] = gb[7]; t[5] = bb[7]; } else { t[6] = rb[7]; t[7] = gb[7]; temp = bool2byte(t); resFName += (char)temp; } }

//Read file on layer 8 (after file name): int tempj = j; i--;

for (; i < height && i * (height / 3) < fSize + fNameSize; i++) for (j = 0; j < (width / 3) * 3 && i * (height / 3) + (j / 3) < (height * (width / 3) * 3) / 3 - 1 && i * (height / 3) + (j / 3) < fSize + fNameSize; j++) { if (tempj != 0) { j = tempj; tempj = 0; } pixel = DecryptedBitmap.GetPixel(j, i); r = pixel.R; g = pixel.G;

60

Page 61: Steganography Engineering project report

b = pixel.B; byte2bool(r, ref rb); byte2bool(g, ref gb); byte2bool(b, ref bb); if (j % 3 == 0) { t[0] = rb[7]; t[1] = gb[7]; t[2] = bb[7]; } else if (j % 3 == 1) { t[3] = rb[7]; t[4] = gb[7]; t[5] = bb[7]; } else { t[6] = rb[7]; t[7] = gb[7]; temp = bool2byte(t); res[i * (height / 3) + j / 3 - fNameSize] = temp; } }

//Read file on other layers: long readedOnL8 = (height * (width/3)*3) /3 - fNameSize - 1;

for (int layer = 6; layer >= 0 && readedOnL8 + (6 - layer) * ((height * (width / 3) * 3) / 3 - 1) < fSize; layer--) for (i = 0; i < height && i * (height / 3) + readedOnL8 + (6 - layer) * ((height * (width / 3) * 3) / 3 - 1) < fSize; i++) for (j = 0; j < (width / 3) * 3 && i * (height / 3) + (j / 3) + readedOnL8 + (6 - layer) * ((height * (width / 3) * 3) / 3 - 1) < fSize; j++) { pixel = DecryptedBitmap.GetPixel(j, i); r = pixel.R; g = pixel.G; b = pixel.B; byte2bool(r, ref rb); byte2bool(g, ref gb); byte2bool(b, ref bb); if (j % 3 == 0) { t[0] = rb[layer]; t[1] = gb[layer]; t[2] = bb[layer]; } else if (j % 3 == 1) { t[3] = rb[layer]; t[4] = gb[layer]; t[5] = bb[layer]; } else {

61

Page 62: Steganography Engineering project report

t[6] = rb[layer]; t[7] = gb[layer]; temp = bool2byte(t); res[i * (height / 3) + j / 3 + (6 - layer) * ((height * (width / 3) * 3) / 3 - 1) + readedOnL8] = temp; } }

if (File.Exists(DSaveFilePath + "\\" + resFName)) { MessageBox.Show("File \"" + resFName + "\" already exist please choose another path to save file", "Error",MessageBoxButtons.OK,MessageBoxIcon.Error); return; } else File.WriteAllBytes(DSaveFilePath + "\\" + resFName, res); toolStripStatusLabel1.Text = "Decrypted file has been successfully saved."; Application.DoEvents(); }

private void byte2bool(byte inp, ref bool[] outp) { if(inp>=0 && inp<=255) for (short i = 7; i >= 0; i--) { if (inp % 2 == 1) outp[i] = true; else outp[i] = false; inp /= 2; } else throw new Exception("Input number is illegal."); }

private byte bool2byte(bool[] inp) { byte outp = 0; for (short i = 7; i >= 0; i--) { if (inp[i]) outp += (byte)Math.Pow(2.0, (double)(7-i)); } return outp; }

private void Decrypt_btn_Click(object sender, EventArgs e) {

if (DeSaveFile_tbx.Text == String.Empty || DeLoadImage_tbx.Text == String.Empty) {

62

Page 63: Steganography Engineering project report

MessageBox.Show("Text boxes must not be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }

if (System.IO.File.Exists(DeLoadImage_tbx.Text) == false) { MessageBox.Show("Select image file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); DeLoadImage_tbx.Focus(); return; }

DecryptLayer(); }

private void DeLoadImageBrowse_btn_Click(object sender, EventArgs e) { if (openFileDialog3.ShowDialog() == DialogResult.OK) { DLoadImagePath = openFileDialog3.FileName; DeLoadImage_tbx.Text = DLoadImagePath; DecryptedImage = Image.FromFile(DLoadImagePath); height = DecryptedImage.Height; width = DecryptedImage.Width; DecryptedBitmap = new Bitmap(DecryptedImage);

FileInfo imginf = new FileInfo(DLoadImagePath); float fs = (float)imginf.Length / 1024; ImageSize_lbl.Text = smalldecimal(fs.ToString(), 2) + " KB"; ImageHeight_lbl.Text = DecryptedImage.Height.ToString() + " Pixel"; ImageWidth_lbl.Text = DecryptedImage.Width.ToString() + " Pixel"; double cansave = (8.0 * ((height * (width / 3) * 3) / 3 - 1)) / 1024; CanSave_lbl.Text = smalldecimal(cansave.ToString(), 2) + " KB";

canPaint = true; this.Invalidate(); } }

private void DeSaveFileBrowse_btn_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { DSaveFilePath = folderBrowserDialog1.SelectedPath; DeSaveFile_tbx.Text = DSaveFilePath; } }

private void Form1_Paint(object sender, PaintEventArgs e) {

63

Page 64: Steganography Engineering project report

if(canPaint) try { if (!EncriptionDone) e.Graphics.DrawImage(loadedTrueImage, previewImage); else e.Graphics.DrawImage(AfterEncryption, previewImage); } catch { e.Graphics.DrawImage(DecryptedImage, previewImage); } }

private string justFName(string path) { string output; int i; if (path.Length == 3) // i.e: "C:\\" return path.Substring(0, 1); for (i = path.Length - 1; i > 0; i--) if (path[i] == '\\') break; output = path.Substring(i + 1); return output; }

private string justEx(string fName) { string output; int i; for (i = fName.Length - 1; i > 0; i--) if (fName[i] == '.') break; output = fName.Substring(i + 1); return output; }

private void Close_btn_Click(object sender, EventArgs e) { this.Close(); }

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("");

}

}}

64