enhanced visual cryptocraphy

77
ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB Dept of ECE 1 SJCET CHAPTER -1 INTRODUCTION 1.1 Overview: The basic principle of the visual cryptography scheme (VCS) was first introduced by Naor and Shamir. VCS is a kind of secret sharing scheme that focuses on sharing secret images. The idea of the visual cryptography model proposed in is to split a secret image into two random shares (printed on transparencies) which separately reveals no information about the secret image other than the size of the secret image. The secret image can be reconstructed by stacking the two shares. The underlying operation of this scheme is logical operation OR. In this paper, we call a VCS with random shares the traditional VCS or simply the VCS. In general, a traditional VCS takes a secret image as input, and outputs shares that satisfy two conditions: 1) any qualified subset of shares can recover the secret image; 2) any forbidden subset of shares cannot obtain any information of the secret image other than the size of the secret image but after stacking shares ,the secret image can be observed visually by the participants. VCS has many special applications, for example, transmitting military orders to soldiers who may have no cryptographic knowledge or computation devices in the battle field. Many other applications of VCS, other than its original objective (i.e., sharing secret image), have been found, for example, authentication and identification, watermarking and transmitting passwords etc. The associated secret sharing problem and its physical properties such as contrast, pixel expansion, and color were extensively studied by researchers worldwide. For example, showed constructions of threshold VCS with perfect reconstruction of the black pixels. Secret sharing schemes are ideal for storing information that is highly sensitive and highly important. Examples include: encryption keys, missile launch codes.Each of these pieces of information must be kept highly confidential, as their exposure could be disastrous, however, it is also critical that they should not be lost. Traditional methods for encryption are ill-suited for simultaneously achieving high

Upload: lakshmi-velivala

Post on 22-Jan-2018

35 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 1 SJCET

CHAPTER -1

INTRODUCTION

1.1 Overview:

The basic principle of the visual cryptography scheme (VCS) was first

introduced by Naor and Shamir. VCS is a kind of secret sharing scheme that focuses

on sharing secret images. The idea of the visual cryptography model proposed in is

to split a secret image into two random shares (printed on transparencies) which

separately reveals no information about the secret image other than the size of the

secret image. The secret image can be reconstructed by stacking the two shares. The

underlying operation of this scheme is logical operation OR. In this paper, we call a

VCS with random shares the traditional VCS or simply the VCS. In general, a

traditional VCS takes a secret image as input, and outputs shares that satisfy two

conditions: 1) any qualified subset of shares can recover the secret image; 2) any

forbidden subset of shares cannot obtain any information of the secret image other

than the size of the secret image but after stacking shares ,the secret image can be

observed visually by the participants. VCS has many special applications, for

example, transmitting military orders to soldiers who may have no cryptographic

knowledge or computation devices in the battle field. Many other applications of

VCS, other than its original objective (i.e., sharing secret image), have been found,

for example, authentication and identification, watermarking and transmitting

passwords etc.

The associated secret sharing problem and its physical properties such as

contrast, pixel expansion, and color were extensively studied by researchers

worldwide. For example, showed constructions of threshold VCS with perfect

reconstruction of the black pixels.

Secret sharing schemes are ideal for storing information that is highly

sensitive and highly important. Examples include: encryption keys, missile launch

codes.Each of these pieces of information must be kept highly confidential, as their

exposure could be disastrous, however, it is also critical that they should not be lost.

Traditional methods for encryption are ill-suited for simultaneously achieving high

Page 2: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 2 SJCET

levels of confidentiality and reliability. This is because when storing the encryption

key, one must choose between keeping a single copy of the key in one location for

maximum secrecy, or keeping multiple copies of the key in different locations for

greater reliability. Increasing reliability of the key by storing multiple copies lowers

confidentiality by creating additional attack vectors; there are more opportunities

for a copy to fall into the wrong hands. Secret sharing schemes address this

problem, and allow arbitrarily high levels of confidentiality and reliability to be

achieved. The (2, 2) VC scheme divides the secret image into two shares so that

reconstruction of an image from a share is impossible. Each share is printed in

transparency. A share is a random noise. Encryption is performed for each pixel. It

shows the 2 different shares for black and white pixels. In these we have to

understood how a pixel in a image in divided into two sub pixels depending on

whether the pixel is black or white. By doing so the width of the share increases.

This is termed as Pixel Expansion.

1.1.1.Black and White Images:

Visual cryptographic solutions operate on binary or binarized inputs.

Therefore, natural (continuous-tone) images must be first converted into halftone

images by using the density of the net dots to simulate the original gray or color

levels in the target binary representation. Then, the halftone version of the input

image is used instead of the original secret image to produce the shares. The

decrypted image is obtained by stacking the shares together. Because binary data can

be displayed either as frosted or transparent when printed on transparencies or

viewed on the screen, overlapping shares that contain seemingly random information

can reveal the secret image without additional computations or any knowledge of

cryptographic keys. However, due to the nature of the algorithm, the decrypted

image is darker, contains a number of visual impairments, and most of visual

cryptography solutions increase the spatial resolution of the secret image. In

addition, the requirement for inputs of the binary or dithered nature only limits the

applicability of visual cryptography. Most of the existing secret sharing schemes are

generalized within the so-called {k,n}-threshold framework that confidentially

divides the content of a secret message into n shares in the way that requires the

presence of at least k, for k≤n, shares for the secret message reconstruction, Thus,

the framework can use any of n!/(k!(n−k)!) possible combinations of k shares to

Page 3: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 3 SJCET

recover the secret message, whereas the use of k−1 or less shares should not reveal

the secret message.

Use of digital media has exploded in the past few years, primarily due to

several distinct advantages that digital media can offer over analog media. These

advantages include higher quality, easier editing, perfect copying and easier and

more efficient transmission over information network. The wide dissemination of

digital media also creates some potential problems. Due to the popularity of Internet

commerce and digital library applications, the intellectual property right (IPR)

protection is becoming increasingly important. Content providers will be reluctant

to provide their valuable contents if they are not assure d that their contents are

securely protected. Some good examples are the deployments of the digital versatile

disk (DVD) market and the online music market.

Fig1.1: random selection of pixels

1.1.2. VCS and the structures of sub-pixels:

The IPR management and protection issue is currently being addressed in the

emerging MPEG-4 standards for moving pictures compression. Several

technologies have been developed for IPR protection. One is conditional access

Page 4: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 4 SJCET

through encryption. The digital media will be scrambled before it is distributed.

Only authorized users who have the proper key for decryption can access the clear

content. The other one is digital watermarking that securely embeds hidden

message into the multimedia data to identify the owner, or the buyer of a digital

media. These two techniques are complementary to each other. We focus on

conditional access through encryption in this project. Digital images/video are often

communicated or distributed over non-private channels, such as satellite links, cable

television networks, wireless networks, and the Internet.

Conditional access systems for private digital image/video transmission or

storage are a necessity for many applications, for example, pay-tv, confidential

videoconferences, confidential facsimile transmissions, and medical image

transmission and storage in a database. In general, complex cryptography

techniques make cracking of the system difficult, but are also expensive to

implement. Since digital video transmission system usually includes a compression

module that aims to reduce the transmitted bit rate, the cryptography techniques

have to be carefully designed to avoid potential adverse impact on the compression

efficiency, and on the functionalities that the compression format provides.

VC has been studied intensively since the pioneer work of Noor and Shamir. Most

of the previous research work on VC focused on improving two parameters: pixel

expansion and contrast. In these cases, all participants who hold shares are assumed

to be semi-honest, that is, they will not present false or fake shares during the phase

of recovering the secret image. Thus, the image shown on the stacking of shares is

considered as the real secret image.

Nevertheless, cryptography is supposed to guarantee security even under the

attack of malicious adversaries who may deviate from the scheme in any way. We

have seen that it is possible to cheat in VC, though it seems hard to imagine. For

cheating, a cheater presents some fake shares such that the stacking of fake and

genuine shares together reveals a fake image. With the property of unconditional

security, VC is suitable for sending highly classified orders to a secret agent when

computing devices may not be available.

The secret agent carried some shares, each with a pre-determined order, when

departing to the hostile country. When the headquarter decides to execute a specific

order, it can simply send another share to the agent so that the agent can recover

Page 5: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 5 SJCET

what the order is. We can see that it would be terrible if the dispatched share cannot

be verified due to a cheater’s attack.

A VCS would be helpful if the shares are meaningful or identifiable to every

participant. A VCS with this extended characteristic is called extended VCS

(EVCS). EVCS is like a -VCS except that each share displays a meaningful image,

which will be called share image hereafter. Different shares may have different

share images. At first glance, it seems very difficult to cheat in EVCS because the

cheater does not know the share images that appear on the genuine shares and, thus,

has no information about the distributions of black and white pixels of the share

images. This information is crucial for cheating in VC.

A secret image consists of a collection of black and white pixels where each

pixel is treated independently. To encode the secret, we split the original image into

n modified versions (referred as shares) such that each pixel in a share now

subdivides into m black and white sub-pixels. To decode the image, we simply pick

a subset S of those n shares and Xerox each of them onto a transparency. It is

divided into 4 shares, which is denoted by Q containing at least one of the three sets

{1, 2}, {2, 3} or {3, 4}.

Then the qualified sets are exactly the following:

Equal = {1, 2}, {2, 3}, {3, 4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}, {1, 2, 3, 4}

1.1.2.1. How are shares divided?

We have used halftone Visual Cryptography to achieve Visual Cryptography

via half- toning. Based on the blue-noise dithering principles, the proposed method

utilizes the void and cluster algorithm to encode a secret binary image into n

halftone shares (images) carrying significant visual information.

1.1.2.2. How is Cheating done?

The issue of cheating by dishonest participants, called cheaters, in visual

cryptography is that, cheating is possible when the cheaters form a coalition in

order to deceive honest participants. At the outset two simple cheating prevention

visual cryptographic schemes where proposed by G.B.Hond, T.G.Chen, and

D.S.Tsai.

Page 6: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 6 SJCET

1.1.2.3. How is Decoding done?

Along with this basic setup, Noor and Shamir also proposed (k, n) threshold

model as its extension. This extended scheme is constructed such that any k shares

can be stacked together to reveal the original secret.

1.1.3. Modular Description:

This system deals with security during transmission of images. In Cheating

Prevention in Visual Cryptography the following are the main modules and each

module is explained below.

f Images

1.1.3.1. Security & Login Module:

This module deals with ensuring that only authorized users can access to this

application. A database with user-id and password is used to validate the User entry.

The input user-id is validated for a minimum of four characters. The application the

opens into the application screen on validation

1.1.3.2. Encoding the Image:

This system uses the Secret Sharing Scheme, which is a method for sharing a

secret among a set p of p participants. The secret is encoded into n pieces called

shares each of which is given to a distinct participant. Certain qualified subsets of

participants can recover the secret by pooling together their information, whereas

forbidden subsets of participants have information on the secret. The specification

of the qualified sets and the forbidden sets is called access structure. A special kind

of secret sharing scheme are Visual Cryptography Schemes (VCSs), that is,

schemes where the secret to share is an image and the shares consist of Xeroxed

transparencies which are stacked to recover the shared image. In this paper we

analyze the relationship between secret sharing schemes and VCSs, focusing our

attention on the amount of randomness required to generate the shares. We show

how to transform a secret sharing scheme for a given accessness of the original

scheme. An important consequence of this transformation is that lower bounds on

the randomness of visual cryptography schemes apply to general secret sharing

Page 7: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 7 SJCET

schemes. Our randomness preserving transformation has also been applied to derive

a new upper bound on the randomness k, n threshold VCSs which dramatically

improves on the previously known bounds. All VCSs obtained by applying our

randomness preserving transformation allow a perfect reconstruction of black

pixels.

1.1.3.3. Decoding the Image:

The secret image consists of a collection of black and white pixels. To

construct shares of an image for participants, we need to prepare two collections,

which consist of Boolean matrices. A row in a matrix corresponds to sub-pixels of a

pixel, where 0 denotes the white sub-pixel and 1 denotes the black sub-pixel. For a

white (or black) pixel in the image, we randomly choose a matrix from (or,

respectively) and assign row of to the corresponding position of share. Each pixel of

the original image will be encoded into pixels, each of which consists of sub-pixels

on each share. Since a matrix in and constitutes only one pixel for each share. For

security, the number of matrices in and must be huge. For succinct description and

easier realization of the VC construction, we do not construct directly. Instead, we

construct two basis matrices and then let and be the set of all matrices obtained by

permuting columns of and , respectively.

Two collections (multi-sets) of Boolean matrices constitute a -VCS if there exist a

value and a set satisfying the following:

1) Any qualified set can recover the secret image by stacking their shares.

2) Any forbidden set has no information on the secret image.

Formally, the two collections, of matrices obtained by restricting each matrix in to

rows, are indistinguishable in the sense that they contain the same matrices with the

same frequencies.

In visual cryptography scheme, the carriers (share-image holders) will bring their

shares to the target place. The decoder will then stack the share images to find the

original image.

1.1.3.4. Verification of Images :

In existing visual cryptography scheme, the carriers (share-image holders)

will bring their shares to the target place; the decoder will then stack the share

images to find the original image. Here, there is no guarantee that carriers would not

have changed or faked their images. This is the problem statement as known.

Page 8: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 8 SJCET

In the proposed method, the decoder should be able to find whether the share

images brought to the target place are faked or not. Also, each share-holder should

be able to verify that other share-holder images are faked or not. In order to achieve

this, the proposed method creates a verification image for each share holder.

Each shareholder should bring this verification image also to the target place. In the

target place, before decoding, each share-holder will verify the other share-holders

image. Then, the decoder will also check each share-holders image.

In the proposed method, during encoding, a verification image is specified. The

share-images are created in such a way that stacking one share and other share-

holders verification-share will reveal the verification image. Suppose there are two

share- holders. During encoding, two images for each share-holder are created. One

of them is secrete share and other is verification share. So totally four images will

be created during encoding. In the target place, the decoder will know what

verification image should be displayed during stacking. The decoder will check all

verification images by combining each secret share with every other verification

share.

In our implementation, we have taken (2,2) viscrypt scheme. that is, there

will be two share-holders and both two of them will participate in stacking, as u

know. To do automated verification, we have defined the options called flag1 and

flag2 will be enabled after verification only. Also note that the message box should

come automatically showing whether the verification is successful or not. This

cannot be done automatically. The encoding and decoding can be done by

computer. But the verification can be done by humans only, by manually seeing

whether the verification image that came is correct or not. that is, verification can be

done by visually only.

1.2. Problem outline:

It suffers a management problem, because of which dealers cannot visually

identify each share. This problem is solved by the extended visual cryptography

scheme (EVCS), which adds a meaningful cover image in each share. But while

removing the extra cover image it produces extra noise or degrades the hidden

image quality. Hence we are Extending the visual cryptography algorithm without

removing cover images where it reduces pixel expansion problem and shares match

duration.

Page 9: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 9 SJCET

By reducing no of shares with increased participants, we can reduce the

complexity. It makes the decoding system easy and improves the efficiency. The

analysis is done by using the Matlab.

1.3. Objective:

The primary property of visual cryptography is using a method called

stacking shares, to recover secret image. Stacking refers to layering the shares on top

of the one another. The secret dealer creates two or more shares for secret message.

Each can not be caused to make public the secret alone. Receiving all the shares

printing each share on to a transparency and using human visual system, the secret

image can be visible without any computation. In this way, VC has verified to

provide perfect security Furthermore, the technique can be applied to group secret

system, which is using (k, n)-threshold visual secret sharing scheme in order to

perform secret sharing, where k=n. With (k, n)-threshold visual secret sharing

scheme, the dealer or the secret owner can base a group of n participants to produce

n shares for the secret message . Each participant in the group can have his own

share. When recovering the secret message, only k or more transparency stacks are

required without any computation. The secret message cannot be restored if less than

k transparencies are used . Each pixel in the secret image is expanded to four sub

pixels in each share that consist of white and black according to the patterns. The

summary points of Naor and Shamir‟s scheme

1) The secret data can be divided into n parts.

2) Any k or more than k parts can recover the secret

3) Any k -1 or fewer than k parts cannot compute the secret data.

1.4. Approach:

Wu and Chen were first researchers to present the visual cryptography

schemes to share two secret images in two shares. They hidden two secret binary

images into two random shares, namely A and B, such that the first secret can be

seen by stacking the two shares, denoted by A⊗ B, and the second secret can be

obtained by first rotating A Ө anti-clockwise. They designed the rotation angle Ө to

be 90◦. However, it is easy to obtain that Ө can be 180◦ or 270◦. To overcome the

Page 10: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 10 SJCET

angle restriction of Wu and Chen’s scheme, Hsu et al. proposed a scheme to hide

two secret images in two rectangular share images with arbitrary rotating angles.

Wu and Chang also refined the idea of Wu and Chen by encoding

shares to be circles so that the restrictions to the rotating angles (Ө = 90◦, 180◦ or

270◦) can be removed.

In 1994 the basic problem of visual cryptography was introduced by Noor

and Shamir. In visual cryptography we are dealing with the problem of encrypting

pictures in a secure way such that the decryption can be done by the human visual

system. The encryption of a secret image is achieved by encoding the information

into several shadow images, called shares. The decoding is done by printing the

shares on transparencies and stacking them. The system can be used by everyone

without any knowledge of cryptography and without performing cryptographic

computations. This is the major difference to usual cryptography schemes. This is

the major difference to usual cryptography schemes where the secret information,

represented as numbers, is encrypted by using one-way functions. The decryption

can only be done if one knows the appropriate secret key.

Noor and Shamir have described a k out of n (with k<=n ) system where the

secret is encoded in n shares and the decoding can be done by stacking k or more

transparencies. Using less than k transparencies won’t reveal the secret not even to

an infinitely powerful cryptanalyst.

In general it is possible that k and n are reasonably big numbers. In order to

reveal the secret information it is necessary to have at least k people stack their

shares together. Since k can be reasonably big, it might be very unlikely to find a

coalition of at least k traitors who will be willing to misuse their . shares, in general

one share-holder might not even know k-1 other share-holders. Obviously, it is

much easier to find 0<t<k traitors who are looking for a way to sabotage the system.

We assume that t<k share-holders stack their shares together and publish the

information so that other small groups of less than k people can stack their shares

on top of the published information and will therefore be able to reveal the actual

secret. (It is possible to iterate the scenario in such a way that at first the

information of t then t+t’ shares etc. gets published.) Since there is no way in

keeping t people from publishing the accumulated information we are looking for a

possibility to trace the traitors.

Page 11: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 11 SJCET

S J Shyu et al were first researchers to advise the multiple secrets sharing in

visual cryptography. This scheme encodes a set of n ≥ 2 secrets into two circle

shares. The n secrets can be obtained one by one by stacking the first share and the

rotated second shares with n different rotation angles. To encode unlimited shapes

of image and to remove the limitation of transparencies to be circular, Fang offered

reversible visual cryptography scheme. In this scheme two secret images which are

encoded into two shares; one secret image appears with just stacking two shares and

the other secret image appears with stack two shares after reversing one of them.

Jen-Bang Feng et al developed a visual secret sharing scheme for hiding multiple

secret images into two shares. The proposed scheme analyzes the secret pixels and

the corresponding share blocks to construct a stacking relationship graph, in which

the vertices denote the share blocks and the edges denote two blocks stacked

together at the desired decryption angle. According to this graph and the pre-

defined visual pattern set, two shares are generated.

To provide more randomness for generating the shares Mustafa Ulutas et al

advised secret sharing scheme based on the rotation of shares. In this scheme shares

are rectangular in shape and are created in a fully random manner. Stacking the two

shares reconstructs the first secret. Rotating the first share by 90° counterclockwise

and stacking it with the second share reconstructs the second secret.

Tzung-Her Chen et al offered the multiple image encryption schemes by

rotating random grids, without any pixel expansion and codebook redesign. A non-

expansion reversible visual secret sharing method that does not need to define the

lookup table offered by Fang . To encode four secrets into two shares and

recovering the reconstructed images without distortions Zhengxin Fu et al intended

a rotation visual cryptography scheme. Rotation visual cryptography scheme

construction was based on correlative matrices set and random permutation, which

can be used to encode four secret images into two shares. Jonathan Weiretal

suggested sharing multiple secrets using visual cryptography. A master key is

generated for all the secrets; correspondingly, secrets are shared using the master

key and multiple shares are obtained.

Page 12: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 12 SJCET

1.4.1. Visual cryptography scheme for binary Images

Implementation of ‘2 out of 2’ scheme

The (2, 2) – Visual cryptography scheme (VCS) is illustrated to bring in the

basic concepts of threshold visual secret sharing schemes. In the encryption process

every secret pixel is turned into two shares, and each share belongs to the

corresponding share image. In the decryption process the two corresponding shares

are stacked together (using OR operation) to recover the secret pixel. Two share of a

white secret pixel are of the same while those of a black secret pixel are opposite.

Fig 1.2:(a) share-1 (b) share-2

(c) overlapped image

Therefore a white secret pixel is improved by a share with the stacked result of

half white sub-pixels and a black secret pixel is recovered by all black. In XOR

based VCS scheme where the share images are superimposed using XOR operation

which results in perfect reconstruction of both Black and white pixels as and sub

sampling a 2×2 share into a single pixel we get decrypted image of the same size as

original secret image.

1.5. Thesis Outline:

In Chapter 2: Fundamentals of visual cryptography; Chapter 3: Algorithm

approach ; Chapter 4: System Design-Block diagram ,Functional Description of

each Block; Chapter 5:Total Outline; Chapter 6: Result Observation-Simulation

result; Chapter 7:Conclusion and Future Scope

Page 13: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 13 SJCET

CHAPTER -2

FUNDAMENTALS

2.1.Binary Images:

2.1.1. Geometric Properties

For a given image size, a binary image is easier to digitize, store, and

transmit than a full gray-level image, since it contains about an order of magnitude

fewer bits. Naturally, some information is lost and fewer options are open to us in

processing such an image. In fact, we can present a fairly complete theory of what

can and cannot be done with binary images, something that still eludes us in the

case of gray-level images.First of all, we can compute various geometric properties,

such as the size and position of the object in the image. If there is more than one

object in the field of view, we can determine some topological properties of the

assembly, such as the difference between the number of objects and the number of

holes. It is also possible to label the individual objects and to perform the

geometrical computations for each one separately. Finally, we can simplify binary

images for further processing by modifying them in an iterative fashion.Binary

image processing is well understood and lends itself to highspeed hardware

implementation, but one must keep in mind its limitations.We have already

mentioned the need for high object-to-background contrast.Moreover, the pattern

obtained must be essentially two-dimensional.Remember that all we have is the

outline or silhouette of the object. This gives little information about the object’s

overall shape or its attitude in space.The characteristic function b(x, y) has a value

for each point in the image. We call this a continuous binary image. Later, we shall

consider discrete binary images, obtained by tessellating the image plane suitably.

2.1.1.1. Simple Geometrical Properties:

Assume for now that we have a single object in the field of view. Thearea of

the object, given the characteristic function b(x, y), can be found as

A = ∫∫I b(x, y) dx dy,

Page 14: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 14 SJCET

where the integration is over the whole image I. If there is more than one object,

this formula will give the total area.

2.1.1.2. Area and Position:

How do we determine the position of the object in the image? Since the

object is usually not just a single point, we must give a precise meaning

to the term “position.” The usual practice is to choose the center of area

as the representative point .

2.1.1.3. Orientation:

We also want to determine how the object lies in the field of view, that

is, its orientation. This is a little harder. Let us assume that the object is somewhat

elongated; then the orientation of the axis of elongation can be used to define the

orientation of the object . (There is a remaining two-way ambiguity, however, as

discussed .) How precisely do we define the direction in which the object is

elongated? The usual practice is to choose the axis of least second moment. This is

the two-dimensional equivalent of the axis of least inertia. We find the line for

which the integral of the square of the distance to points in the object is a minimum;

that integral is

E = ∫∫ I r2

b(x, y) dx dy,

where r is the perpendicular distance from the point (x, y) to the line sought after.

To choose a particular line in the plane, we need to specify two parameters.A

convenient pair consists of the distance ρ from the origin to the closest point on the

line, and the angle θ between the x-axis and the line, measured counterclockwise

.We prefer these parameters because they change continuously when the coordinate

system is translated or rotated. There are no problems when the line is parallel, or

nearly parallel, to either of the coordinate axes. Using these parameters, we can

write the equation of the line in the form

Page 15: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 15 SJCET

x sin θ − y cos θ + ρ = 0

by noting that the line intersects the x-axis at −ρ/ sin θ and the yaxis

at +ρ/ cos θ. The closest point on the line to the origin is at (−ρ sin θ,+ρ cos θ). We

can write parametric equations for points on the line as follows:

x0 = −ρ sin θ + s cos θ and y0 = +ρ cos θ + s sin θ,

where s is the distance along the line from the point closest to the origin

2.1.1.4. Projections:

The position and orientation of an object can be calculated using first and

second moments only We do not need the original image to obtain

the first and second moments; projections of the image are sufficient. This is of

interest since the projections are more compact and suggest much faster algorithms.

2.1.2. Discrete Binary Images:

So far we have dealt with continuous binary images, defined at all pointsin

the image plane. It should be obvious that the integrals become sumswhen we turn

to discrete binary images The area, for example,can be computed using the sum

A = ∑n i=1∑m

j=1 bij,

Where bij is the value of the binary image at the point in the ith row and the jth

column.Here we have assumed that the image has been digitized on a square grid

with n rows and m columns. Usually the image is scanned out row by row, in the

same sequence as the beam on a television set explores the screen (except for

interlace). As each picture cell is read, we check whether bij = 1. If so, we add 1, i,

j,i2, ij, and j2 to the accumulated totals for the area, first moments, and second

moments, as appropriate. At the end of the scan, the area, position, and orientation

can be easily calculated from these totals.

Page 16: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 16 SJCET

2.1.2.1. Run-Length Coding:

For binary images there are several coding techniques that can compress the

data even further. A popular one is run-length coding. This method exploits the fact

that along any particular scan line there will usually be

long runs of zeros or ones. Instead of transmitting the individual bits, then,we can

send numbers indicating the lengths of such runs. The run-length code for the image

line

0 1 1 1 1 0 0 0 1 1 0 0 0 0

is just . Some special code may be used to indicate the beginning of each line.

Further, a convention is followed as to whether the line starts with a zero or a one.

If the line starts the other way, an initial run-length code of zero is sent. Let us use

the convention that rik is the kth run of the ith line and that the first run in each row

is a run of zeros. (Thus all the even runs will correspond to ones in the image.)

Suppose further that there are mi runs on the ith line. (This number will be odd if

the last run contains zeros.) How do we use run-length codes to rapidly compute the

desired geometric properties? Clearly the area is just the sum of the run lengths

corresponding to ones in the image:

n mi ∕ 2

A = ∑ ∑ ri,2k

i=1 k=1

Note that the sum is over the even runs only. The center of area is a

little harder to calculate. First of all, we obtain the horizontal projection

mi ∕ 2

hi = ∑ ri ,2k

k=1

From this we can easily compute the vertical position i of the center of area

Using

n Ai = ∑ i hi

i=1

But what about the vertical projection vj? Remember that a particular

entry in this projection is obtained by adding up all picture cell values

in one column of the image. It is therefore hard to compute the vertical

projection directly from the run lengths.

Page 17: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 17 SJCET

2.1.2.2. Bitmap images :

Bitmap images are made of individual dots called pixels (picture elements)

that are arranged and colored differently to form a pattern .The individual squares

that make up the total image can be seen when zoomed in. However, from a greater

distance the color and shape of a bitmap image appear continuous .Since each pixel

is colored individually, you can easily work with photographs with so many colors

and can create photorealistic effects such as shadowing and increasing color by

manipulating select areas, one pixel at a time. Bitmap programs are ideal to retouch

photographs, editing images and video files and creating original artwork. Variety

of changes to photographs can be made, such as adjusting the lighting, removing

scratches, people, and things, swapping details between images, adding text and

objects, adjusting color, and applying combinations of special effects.

Fig 2.1: bitmap images

To the left you see an image and to the right the top of one of the mountains

when zoomed in. As you can see, the image consists of hundreds of rows and

columns of small elements that all have their own color. Hence, if you work on a

bigscale multimedia project or design a Web site, what graphic formatwill be the

best choice for your needs? Which features of images are more important for the

nature of your project: flexibility in scaling, file size, or photorealistic vs.computer

generated look? In the next section, I will talk about these issues.

Page 18: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 18 SJCET

Bitmap Image

Text

Text

Whereas, bitmap image formats give a realistic result for representation of

the real world, vectorbased images can only come as close as cartoon style drawings

of the objects For instance, you cannot easily scale bitmap images, but you can

control every single pixel. Thus, when you work with complex images, such as

photographs, you can do number of effects whi ch are impossible in vector based

images If you want photorealistic images, then the solution will be the use of

bitmaps. However, if the download speed of graphics is important for youand your

audience and the graphics are supposed to be resized and manipulated, then you

should consider vector based formats.

2.2. Secret sharing Algorithm:

In cryptography, secret sharing refers to a method for distributing a secret

amongst a group of participants, each of which is allocated a share of the secret.

The secret can only be reconstructed when the shares are combined together

individual shares are of no use on their own There is a secret picture to be shared

among n participants.The picture is divided into n transparencies(shares) such that

if any m transparencies are placed together, the picture becomes visible but if fewer

than m transparencies are placed together, nothing can be seen.

A secret-sharing scheme is a method by which a dealer distributes shares to

parties such that only authorized subsets of parties can reconstruct the secret.

Secret-sharing schemes are important tools in cryptography and they are used as a

building box in many secure protocols, e.g., general protocol for multiparty

computation, Byzantine agreement, threshold cryptography, access control,

attribute-based encryption, and generalized oblivious transfer messages. Secret

sharing (also called secret splitting) refers to methods for distributing a

secret amongst a group of participants, each of whom is allocated a share of the

secret. The secret can be reconstructed only when a sufficient number, of possibly

Page 19: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 19 SJCET

different types, of shares are combined together; individual shares are of no use on

their own.

In one type of secret sharing scheme there is one dealer and n players. The

dealer gives a share of the secret to the players, but only when specific conditions

are fulfilled will the players be able to reconstruct the secret from their shares. The

dealer accomplishes this by giving each player a share in such a way that any group

of t (for threshold) or more players can together reconstruct the secret but no group

of fewer than t players can. Such a system is called a (t, n)-threshold scheme

sometimes it is written as an (n, t)-threshold scheme.

There is a simple algorithm for binary (black and white) visual cryptography

that creates 2 encrypted images from an original unencrypted image.

The algorithm is as follows:

First create an image of random pixels the same size and shape as the original

image.

Set the same pixel of the second encrypted image to the opposite color. Where a

pixel of the original image is different than the corresponding pixel in the first

encrypted image.

The two apparently random images can now be combined using an exclusive-or

(XOR) to re-create the original image

Page 20: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 20 SJCET

Fig 2.2:secret image,share 1&share 2,overlapped image

From secret image two shares are generated,those are share 1& share 2 are

generates from black &white pixel components of secret image.Then these shares

are overlapped it leads to Decrypted image that is approximately equal to original

secret image,

2.2.1. Current Methodology:

In the current scenario, as shown in the Figure, when the end user wants to

access his confidential information online (in the form of money transfer or payment

gateway) by logging into his bank account or secure mail account, the person enters

information like username, password, credit card no. etc. on the login page. But quite

often, this information can be captured by attackers using phishing techniques (for

instance, a phishing website can collect the login information the user enters and

redirect him to the original site). There is no such information that cannot be directly

obtained from the user at the time of his login input.

In the current scenario, as shown in the Figure when the end user wants to access

his confidential information online (in the form of money transfer or payment

gateway) by logging into his bank account or secure mail account, the person enters

information like username, password, credit card no. etc. on the login page. But

Page 21: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 21 SJCET

quite often, this information can be captured by attackers using phishing techniques

(for instance, a phishing website can collect the login information the user enters

and redirect him to the original site). There is no such information that cannot be

directly obtained from the user at the time of his login input.

Fig 2.3: Existing system scenario

2.3. Blur Kernal:

In image processing, a kernel, convolution matrix, or mask is a

small matrix useful for blurring, sharpening, embossing, edge-detection, and more.

This is accomplished by means of convolution between a kernel and an image.

2.3.1. The Gaussian kernel:

The Gaussian (better Gaußian) kernel is named after Carl Friedrich Gauß

(1777-1855), a brilliant German mathematician. This chapter discusses many of the

nice and peculiar properties of the Gaussian kernel.

Page 22: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 22 SJCET

Fig 2.4: The Gaussian kernel is apparent on every German banknote of DM 10,-

where it is depicted next to its famous inventor when he was 55 years old. The new

Euro replaces these banknotes.

The Gaussian kernel is defined in 1-D, 2D and N-D respectively as

In 1-D G1D In 2-D G2D

-(x2 /2σ2) -((x2 +y2)/2σ2)

G1D(x;σ) = (1/√2πσ)* e G2D(x,y;σ) = (1/2πσ2)* e

The s determines the width of the Gaussian kernel. In statistics, when we

consider the Gaussian probabilitydensity function it is called the standard deviation,

and the square of it, s2, the variance. In the rest of this book, when we consider the

Gaussian as an aperture function of some observation, we will refer to s as the

inner scale or shortly scale. In the whole of this book the scale can only take

positive values, s > 0. In the process of observation s can never become zero. For,

this would imply making an observation through an infinitesimally small aperture,

which is impossible. The factor of 2 in the exponent is a matter of convention,

because we then have a 'cleaner' formula for the diffusion equation, as we will see

later on. The semicolon between the spatial and scale parameters is conventionally

put there to make the difference between these parameters explicit. The scale-

dimension is not just another spatial dimension, as we will thoroughly discuss

in the remainder of this concept.

Standard Deviation:

The Standard deviation of the Gaussian function plays an important role in its

behaviour.The values located between +/- σ account for 68% of the set, while two

standard deviations from the mean (blue and brown) account for 95%, and three

standard deviations account for 99.7%.This is very important when designing a

Gaussian kernel of fixed length.

Page 23: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 23 SJCET

The Gaussian function is used in numerous research areas:

It defines a probability distribution for noise or data.

It is a smoothing operator.

It is used in mathematics.

The Gaussian function has important properties which are verified with

respect to its integral:

-∞

I = ∫ exp(-X2) dx=√∏

In probabilistic terms, it describes 100% of the possible values of any

given space when varying from negative to positive valuesGauss function is never

equal to zero.It is a symmetric function.

When working with images we need to use the two dimensional

Gaussian function.This is simply the product of two 1D Gaussian functions for each

and is given by:

- ((x2+y2)/2σ2) G(x,y) =1/2πσ2 e

A graphical representation of the 2D Gaussian distribution with mean(0,0)

and σ = 1 is shown to the right.

The Gaussian filter works by using the 2D distribution as a point-spread

function.This is achieved by convolving the 2D Gaussian distribution function

with the image.We need to produce a discrete approximation to the Gaussian

function.This theoretically requires an infinitely large convolution kernel, as the

Gaussian distribution is non-zero everywhere.Fortunately the distribution has

approached very close to zero at aboutthree standard deviations from the mean.

99% of the distributionfalls within 3 standard deviations.This means we can

normally limit the kernel size to contain only values with in three standard

deviations of the mean.

Page 24: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 24 SJCET

Gaussian kernel coefficients are sampled from the 2D Gaussian

function.

- ((x2+y2)/2σ2)

G(x,y) =1/2πσ2 e

Where σ is the standard deviation of the distribution.

The distribution is assumed to have a mean of zero.

We need to discretize the continuous Gaussian functions to store it as

discrete pixels.

The Gaussian filter is a non-uniform low pass filter.The kernel coefficients

diminish with increasing distance from the kernel’s centre.Central pixels have a

higher weighting than those on the periphery.Larger values of σ produce a wider

peak Kernel size must increase with increasing σ to maintain the Gaussian nature

of the filter.Gaussian kernel coefficients depend on the value of σ.At the edge of the

mask, coefficients must be close to 0.The kernel is rotationally symmetric with no

directional bias.Gaussian kernel is separable which allows fast computation

Gaussian filters might not preserve image brightness.

2.3.2. Gaussian Filtering examples:

Is the kernel 1 6 1 a 1D Gaussian kernel?

Give a suitable integer-value 5 by 5 convolution mask that approximates a

Gaussian function with a σ of 1.4.

How many standard deviations from the mean are

required for a Gaussian function to fall to 5% or 1% of

5%, its peak value?

What is the value of σ for which the value of the

Gaussian function is halved at +/-1 x.

Compute the horizontal Gaussian kernel with mean=0

and σ=1, σ=5.

Gaussian filtering is used to remove noise and detail. It is notparticularly

effective at removing salt and pepper noise.Compare the results below with those

achieved by the median filter.

Page 25: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 25 SJCET

Gaussian filtering is more effective at smoothing images. It has its basis in

the human visual perception system. It has been found that neurons create a similar

filter when processing visual images.The halftone image at left has been smoothed

with a Gaussian filterand is displayed to the right.

This is a common first step in edge detection.The images below have been

processed with a Sobel filter commonlyused in edge detection applications. The

image to the right has had a Gaussian filter applied prior to processing.

Page 26: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 26 SJCET

CHAPTER-3

ALGORITHM APPROACH

3.1. An Extended VC Algorithm for General Access Structure:

Visual cryptography was proposed by Naor and Shamir ,allows the

encryption of secret information in the image form. In the concept of secret sharing,

a secret image can be encrypted as n different share images printed on

transparencies, which are then distributed to n participants. By stacking

transparencies (shares) directly, the secret images can be revealed and visually

recognized by humanswithout any computational devices and cryptographic

knowledge. On the other hand, any one share or a portionof shares can leak nothing

related to the secret image .VC is a very good solution for sharing secrets when

computers cannot be employed for the decryption process. Later on threshold visual

secret sharing scheme, also known as kout- of-n VSS scheme or(k,n)-VSS scheme

have been proposed. Ateniese proposed the concept of general access structure

(GAS) and also developed a VC-based solution for some GASs.By using the GAS ,

dealers can define reasonable combinations of shares as decryption Conditions rather

than specifying the number of shares. Hence, the (k, n)-VSS scheme can be treated

as a special case of the GAS. Conventional VSS schemes generate noise-like

random pixels on shares to hide secret images. So, the secret can be perfectly

concealed on the share images. These schemes suffer from a management problem

so that dealers cannot identify each share visually. The pixel expansion problem is

also a common disadvantage with most of the VSS schemes. When the VC-based

approach is employed, each secret pixel within a secret image is encrypted in a block

consisting of 'm' sub pixels in each constituent share image. Thus, the area of a share

is 'm' times that of the original secret image. Thereby contrast of the recovered

images will be decreased to '1/m' simultaneously. The pixel expansion problem not

only affects the practicability of storage and transmission requirements for shares but

also decreases the contrast of the recovered secret images. So developed a friendly

VC scheme known as the extended visual cryptography scheme, which adds a

meaningful cover image on each share to address the management problem and the

pixel expansion problem.

Page 27: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 27 SJCET

Fig 3.1: Example for Visual Cryptographic Scheme (a) Secret Image (b) Share1

(c) Share2 (d) Stacked Result

This paper proposes a new method that resolves management problem; pixel

expansion problem. This approach can be used for binary secret images

innoncomputer aided decryption environments. The proposed approach consists of

two phases. The first phase of the algorithm uses optimization technique for a given

access structure, constructs a set of noise like shares that are pixelexpansion-free.

This phase identifies and formulates the problem as a combinatorial optimization

problem and then developed a simulated-annealing based algorithm to solve it. The

second phase of the algorithm directly adds a cover image on each share directly via

a stamping algorithm and thereby removing the pixel expansionentirely. The

experimental results shows that this approach is a solution to the pixel expansion

problem of the EVCS. Moreover, the display quality of the recovered image is very

close to that obtained using conventional VC schemes.

3.1.1. Ideal Contrast Secret Sharing Scheme through Meaningful Shares with

Enveloping Digital Watermarking using Bit Plane based (k,n)-VCS:

A new secret sharing scheme with meaningful shares using (k,n)-threshold

visual cryptography and digital watermarking for grayscale images based on bit

plane encoding is proposed in this method. Initially, an image is decomposed into its

bit plane images that generate a binary image at each bit plane. Secondly, the

traditional binary secret sharing scheme is used to get the sharing images. Finally, a

proposed watermarking technique is used to generate meaningful shares. To decrypt

hidden secret image, extract the shares from the cover image and decompose each

share into bit planes and then secret grayscale image is reconstructed. This scheme

Page 28: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 28 SJCET

provides a more efficient way to hide images in different meaningful shares. To

reduce the interest of hackers, we have proposed a technique called digital

enveloping. This is nothing but an extended invisible digital watermarking

technique. Using this technique, the shares, produced by k-n secret sharing visual

cryptography are embedded into the envelope images by LSB replacement . This can

be done by replacing the b Least Significant Bits (LSB) of each channel represented

with 8 bits of the 24-bit color image.

3.2. Phase 1-Generating I-Shares:

This phase 1 of this method aims to construct a pixel expansion-free VCS for

a given access structure (Tqual,Tforb). The idea behind the solution is as follows. A

security system employs n' different keys to protect a secretand distributes these keys

to n different participants. Each and every key may be duplicated and will be

distributed to at least one participant. Each participant is allowed to hold at least one

key.

If someone wants to access the secret, he/she has to collect n' different keys

from a set of participants. If he/she misses any one type of key, the secret will

remain protected. So for an access structure(Tqual, Tforb)the dealer has to carefully

distribute n' different keys to any set of participants X,X ЄTqual and has to

guarantee that any set of participants Y, YЄTforb, will not hold all types of keys. In

summary, phase I of the proposed algorithm contains two sub procedures: First,

finding the number of basis n' shares and a corresponding construction set C for a

(Tqual,Tforb)- VCS. We develop a GAS solver to deal with these works. Before

Encryption we need to halftone the color secret image in to binary image and

generate color meaningful shares R,G,B with the proposed scheme. During this

phase an Error Diffusion Half toning algorithm is used to halftone the Secret Image.

Second, basis shares S1,...,Sn that were yielded by constructions of (n',n')-VCS and

the construction set C will be utilized to obtain uncovered I-shares. This work will be

carried out by This work will be carried out by the encryptor using Yang's

probabilistic vss scheme and the share synthesizer. In the 2nd phase, a stamping

algorithm based on LSB replacement in which cover images itself will stamp

together produces the resultant secret image. During that phase an Inverse

Halftoning algorithm using Neural Network method is used for generating the secret

Page 29: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 29 SJCET

image. The proposed methods offer a high quality of secret image compared with the

previous schemes.

3.2.1. GAS Solver-General Access Structure Solver:

For a set of participants P= {i1,i2,….in} and access structure (ΓQual , ΓForb)

the GAS solver is used to finding a construction set C with minimal n1.In this

section, we develop an algorithm based on the simulated annealing approach to solve

the proposed mathematic optimization formulation for the GAS problem. Inorder to

simplify optimization procedures, use penalized energy function in the model. The

penalized energy function Ep can be defined as Ep= Nf + |TQual| / (1 + Nq) where

Nq denotes the amount of a set that can recover the secret image and Nf represents

the amount of an insecure forbidden set in TForb. Our solution approach adopts an

iterative improvement framework. The iteration is based on the decision variable n1.

The proposed iterative improvement framework is listed in Algorithm 1. The pseudo

code for the proposed SAbasedalgorithm, GAS_SA() is in Ref.

(a)Algorithm : SA based algorithm for GAS Solver:

(b)Algorithm for Share Constructor:

The share constructor consists of two modules in Figure 1: the encryptor and

share synthesizer. The encryptor adopts Yang’s construction for the (n1,n1) –

ProbVSS scheme. In the share constructor, encryptor generates the basis shares by

Page 30: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 30 SJCET

employing Yang’s ProbVSS scheme. Then the share synthesizer produces

intermediate shares (I- shares) by stacking the basis shares upon the construction set

C. The procedure for the share constructor is described in Ref . The share constructor

phase is applied on three planes.

3.3. Phase II-Stamping:

After generating color shares using Error diffusion halftoning algorithm,

those color shares are encrypted using Yang's Prob VSS scheme and synthesized, ie

distributes those shares to corresponding P participants. In the 2nd phase,a stamping

algorithm is used in which cover images itself will stamp together produces the

resultant secret image. If the random looking shares are enveloped into meaningful

images using cover images, the interest of hackers can be reduced, thereby providing

more security to visual cryptography. Otherwise hackers thought that it might be a

critical information. Therefore here used a technique called digital enveloping or

stamping or embedding of cover images into shares using LSB replacement. In LSB

steganography , the least significant bits of the cover media's digital data are used to

conceal the message.LSB replacement steganography flips the last bit of each of the

data values to reflect the message that needs to be hidden. Consider an 8-bit

grayscale bitmap image where each pixel is stored as a byte representing a grayscale

value.It is clear that on average, only half the LSBs need to change.The difference

between the cover (i.e. original) image and the stego image will be hardly noticeable

to the human eye.Results show a cover image and a stego image with data is

embedded, there is no visible difference between the two images.LSB matching

randomly increments or decrements the data value by one. LSB matching is also

known as ±1 embedding.

Page 31: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 31 SJCET

Proposed Stamping Algorithm:

3.4. Proposed Scheme :

In the Proposed scheme we used (2, 2) Visual Cryptography Scheme. The

whole design is divided into two process

1) Encryption(Creating shares)

2) Decryption(Human Visual System)

3.4.1. Encryption process

Encryption process is partitioned into two stages and shown in figure

(a)First stage :

An original binary image of size 100X100 has been considered in our design

where each pixel is either 0 or 1.

A (2, 2) Visual Sharing technique is applied on original binary image. From

this process two binary share images will be generated.

(b)Second stage :

In the second stage four share images are generated from the two share

images obtained from first stage using (2,2) VCS, this is called chain share of order

2. Further to enhance the security, share encryption is performed on four shares

obtained from previous step using 8-bit different LFSR sequence XOR ing the share

bit with LFSR bit and it is repeated for whole binary share image. Hence, no two

share should generate partial image.

Page 32: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 32 SJCET

Fig 3.2 : Encryption of shares

3.4.2. Decryption process :

Decryption process is reverse process of encryption. It consists of two stages

and pictorial representation of decryption process is given in figure.

(a)First Stage :

To decrypt the four shares from encrypted shares same LFSR sequence must

be used which was used in earlier encryption process and bitwise XOR operation

performed between encrypted share and LFSR bit sequence. Otherwise original

image will not be recovered in future.

From four decrypted share of the previous step, two partial shares were

obtained by performing bitwise logical ORing between share 1,2 and share 3,4.

(b)Second Stage:

Bitwise logical OR operation performed on two obtained share images from

previous stage to get back the retrieved image. The obtained image is identical to

original image.

Page 33: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 33 SJCET

Figure 3.3: Encryption Process with two stages

Figure 3.4 : Decryption Process with two stages

3.4.3. Results :

Matlab 7.2 Software tool is used to analyze the result. To study the

performance of proposed scheme three different binary images of size 100X100

were used and shown in figures. The stage by stage result of proposed scheme is

given in table .

Page 34: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 34 SJCET

Fig 3.5:secret image1

Fig 3.6:secret image2 Fig 3.7:secret image3

shows the Encryption process of the original binary image. In the table Figure shows

three different original binary images, are shares generated in the 1st stage. The

result shows no residual information of original image perceptually observed among

the two shares. In the second stage four different shares are generated and is given in

In this four shares stacking process of any two shares gives residue of original

information. So to provide additional security share encryption is performed on all

the four shares as discussed is scrambled shares using 8 stage LFSR sequence.

Page 35: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 35 SJCET

Table 3.1: Encryption process:

Table gives decryption process and it is reverse process of encryption. In the table3

the figure is same scrambled share image. The same LFSR initial sequence or key

need to be used to get back the four shares. The obtained shares are shown in the

figure. It is observed that no residual information is visually seen. Figure are the

shares obtained from BIT ORing the shares shown in Fig 4p and 4q and Fig

respectively. Reconstructed image given in figure obtained by BIT ORing the

previous shares i.e.,Fig From figure image can be easily identified but contrast is

poor. In order to obtain the efficient reconstructed image Bitwise XOR is applied

between the shares and obtained image shown in figure.The figure image is identical

to original image except the size.

Page 36: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 36 SJCET

Table 3.2: Decryption Process:

3.4.4. Conclusion :

Using the proposed design original image successfully encoded into 4 share

images. In This scheme two stages were used it’s very difficult to access the original

information by unauthorized receiver. In this paper we used only order 2(two stages)

because if we increase the order even though we can generate many number of

shares, but quality of the reconstructed image will be poor (more number of

columns) and needs more storage space for shares.Difficulties for image

reconstruction by unauthorized receiver

1. Order and orientation of chain share: If the order of the chain share is

unknown and orientation is mismatched we will not get the original image

2. LFSR sequence: We have to use same LFSR sequence for encryption as well

as decryption to get back the original image

Page 37: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 37 SJCET

3. Number of shares: All the four shares compulsorily necessary to identify the

original binary image. The secret image consists of a collection of black and white

pixels. To construct shares of an image for participants, we need to prepare two

collections, which consist of Boolean matrices. A row in a matrix corresponds to

sub-pixels of a pixel, where 0 denotes the white sub-pixel and 1 denotes the black

sub-pixel. For a white (or black) pixel in the image, we randomly choose a matrix

from (or, respectively) and assign row of to the corresponding position of share.

Each pixel of the original image will be encoded into pixels, each of which consists

of sub-pixels on each share. Since a matrix in and constitutes only one pixel for

each share. For security, the number of matrices in and must be huge. For succinct

description and easier realization of the VC construction, we do not construct and

directly. Instead, we construct two basis matrices and then let and be the set of all

matrices obtained by permuting columns of and, respectively. Two collections

(multi-sets) and of Boolean matrices constitute a –VCS.

Each white pixel in the original image is split into two of the same small blocks that

have half black and white pixels. When these two blocks are overlapped, they line

up exactly, and the result is a light-colored block (with half black and half white

pixels). Each black pixel in the original logo is split into two complementary small

blocks. When these two blocks are overlapped, the result is a completely black box.

If each pixel in the original image is split randomly as described above, then each

individual share is a totally random collection of blocks. Only when the shares are

combined is any information revealed about the original image.

Page 38: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 38 SJCET

CHAPTER-4

SYSTEM DESIGN

4.1.Block Diagram

Fig 4.1: Block Diagram of VCS

4.2. PLAIN TEXT:

The message in its original-human readable-form is called Plain text.

In cryptography, plaintext is information a sender wishes to transmit to a

receiver. Cleartext is often used as a synonym. Plaintext has reference to the

operation of cryptographic algorithms, usually encryption algorithms, and is the

input upon which they operate. Cleartext, by contrast, refers to data that is

transmitted or stored unencrypted.

4.2.1. Overview of Plain Text:

Before the computer era, plaintext most commonly meant message text in the

language of the communicating parties. Since computers became commonly

available, the definition has expanded to include:

Page 39: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 39 SJCET

messages (for example, email messages)

document content such as word processor and spreadsheet files

audio and video files, digital photographs and any other multimedia

files containing other files such as Zip files or ISO images

ATM, credit card and other banking information

sensor data

any other data that a person wishes to keep private

Much of this data is not directly meaningful to humans, being already

transformed into computer manipulable forms. While the original definition implied

that the message could be read by a human being, the modern definition emphasizes

that a person using a computer could easily interpret the data.

Any information which the communicating parties wish to conceal from

others can now be treated, and referred to, as plaintext. Thus, in a significant sense,

plaintext is the 'normal' representation of data before any action has been taken to

conceal, compress, or 'digest' it. It need not represent text, and even if it does, the

text may not be "plain".

Plaintext is used as input to an encryption algorithm the output is usually

termed ciphertext particularly when the algorithm is a cipher. Codetext is less often

used, and almost always only when the algorithm involved is actually a code. In

some systems, however, multiple layers of encryption are used, in which case the

output of one encryption algorithm becomes plaintext input for the next.

4.2.2. Secure handling of plaintext :

In a cryptosystem, weaknesses can be introduced through insecure handling

of plaintext, allowing an attacker to bypass the cryptography altogether. Plaintext is

vulnerable in use and in storage, whether in electronic or paper format. Physical

security deals with methods of securing information and its storage media from

local, physical, attacks. For instance, an attacker might enter a poorly secured

building and attempt to open locked desk drawers or safes. An attacker can also

engage in dumpster diving, and may be able to reconstruct shredded information if it

is sufficiently valuable to be worth the effort. One countermeasure is to burn or

thoroughly crosscut shred discarded printed plaintexts or storage media; NSA is

infamous for its disposal security precautions.

Page 40: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 40 SJCET

If plaintext is stored in a computer file (and the situation of automatically

made backup files generated during program execution must be included here, even

if invisible to the user), the storage media along with the entire computer and its

components must be secure. Sensitive data is sometimes processed on computers

whose mass storage is removable, in which case physical security of the removed

disk is separately vital. In the case of securing a computer, useful (as opposed

to hand waving) security must be physical (e.g., against burglary, brazen removal

under cover of supposed repair, installation of covert monitoring devices, etc.), as

well as virtual (e.g., operating system modification, illicit network access,

Trojan programs, ...). The wide availability of key drives, which can plug into most

modern computers and store large quantities of data, poses another severe security

headache. A spy (perhaps posing as a cleaning person) could easily conceal one and

even swallow it, if necessary.

Discarded computers, disk drives and media are also a potential source of

plaintexts. Most operating systems do not actually erase anything — they simply

mark the disk space occupied by a deleted file as 'available for use', and remove its

entry from the file system directory. The information in a file deleted in this way

remains fully present until overwritten at some later time when the operating system

reuses the disk space. With even low-end computers commonly sold with many

gigabytes of disk space and rising monthly, this 'later time' may be months later, or

never. Even overwriting the portion of a disk surface occupied by a deleted file is

insufficient in many cases. Peter Gutmann of the University of Auckland wrote a

celebrated 1996 paper on the recovery of overwritten information from magnetic

disks; areal storage densities have gotten much higher since then, so this sort of

recovery is likely to be more difficult than it was when Gutmann wrote.

Also, independently, modern hard drives automatically remap sectors that are

starting to fail; those sectors no longer in use will contain information that is

entirely invisible to the file system (and all software which uses it for access to disk

data), but is nonetheless still present on the physical drive platter. It may, of course,

be sensitive plaintext. Some government agencies (e.g., NSA) require that all disk

drives be physically pulverized when they are discarded, and in some cases,

chemically treated with corrosives before or after. This practice is not widespread

outside of the government, however. For example, Garfinkel and Shelat (2003)

Page 41: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 41 SJCET

analyzed 158 second-hand hard drives acquired at garage sales and the like and

found that less than 10% had been sufficiently sanitized. A wide variety of personal

and confidential information was found readable from the others. See data

remanence.

Laptop computers are a special problem. The US State Department, the

British Secret Service, and the US Department of Defense have all had laptops

containing secret information,some perhaps in plaintext form, 'vanish' in recent

years. Announcements of similar losses are becoming a common item in news

reports. Disk encryption techniques can provide protection against such loss or theft

if properly chosen and used.

On occasion, even when the data on the host systems is itself encrypted, the

media used to transfer data between such systems is nevertheless plaintext due to

poorly designed data policy. An incident in October 2007 in which HM Revenue

and Customs lost CDs containing no less than the records of 25 million child

benefit recipients in the United Kingdom the data apparently being entirely

unencrypted is a case in point.

Modern cryptographic systems are designed to resist known plaintext or

even chosen plaintext attacks and so may not be entirely compromised when

plaintext is lost or stolen. Older systems used techniques such

as padding and Russian copulation to obscure information in plaintext that could be

easily guessed, and to resist the effects of loss of plaintext on the security of the

cryptosystem.

4.3. CIPHER TEXT:

The message in its coded human unreadable form is called Cipher text.

In cryptography, ciphertext (or cyphertext) is the result of encryption performed

on plaintext using an algorithm, called a cipher. Ciphertext is also known as

encrypted or encoded information because it contains a form of the original plaintext

that is unreadable by a human or computer without the proper cipher to decrypt

it. Decryption, the inverse of encryption, is the process of turning ciphertext into

readable plaintext. Ciphertext is not to be confused with code text because the latter

is a result of a code, not a cipher.

Page 42: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 42 SJCET

4.3.1. Types of Ciphers:

The history of cryptography began thousands of years ago. Cryptography

uses a variety of different types of encryption. Earlier algorithms were performed by

hand and are substantially different from modern algorithms, which are generally

executed by a machine.

(a)Historical ciphers:

Historical pen and paper ciphers used in the past are sometimes known

as classical ciphers. They include:

(b)Substitution cipher:

The units of plaintext are replaced with ciphertext (Caesar Cipher and one-

time pad).In cryptography, a substitution cipher is a method of encoding by which

units of plaintext are replaced with ciphertext, according to a regular system; the

"units" may be single letters (the most common), pairs of letters, triplets of letters,

mixtures of the above, and so forth. The receiver deciphers the text by performing

an inverse substitution.

Substitution ciphers can be compared with transposition ciphers. In a

transposition cipher, the units of the plaintext are rearranged in a different and

usually quite complex order, but the units themselves are left unchanged. By

contrast, in a substitution cipher, the units of the plaintext are retained in the same

sequence in the ciphertext, but the units themselves are altered.

There are a number of different types of substitution cipher. If the cipher

operates on single letters, it is termed a simple substitution cipher; a cipher that

operates on larger groups of letters is termed polygraphic. A monoalphabetic

cipher uses fixed substitution over the entire message, whereas a polyalphabetic

cipher uses a number of substitutions at different positions in the message, where a

unit from the plaintext is mapped to one of several possibilities in the ciphertext and

vice versa.

Page 43: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 43 SJCET

(c)Transposition cipher: the ciphertext is a permutation of the plaintext (Rail fence

cipher). In cryptography, a transposition cipher is a method of encryption by which

the positions held by units of plaintext (which are commonly characters or groups of

characters) are shifted according to a regular system, so that the ciphertext

constitutes a permutation of the plaintext. That is, the order of the units is changed

(the plaintext is reordered). Mathematically a bijective function is used on the

characters' positions to encrypt and an inverse function to decrypt.

These are two types

Rail Fence cipher

Route cipher

(d)Polyalphabetic cipher: A substitution cipher using multiple substitution

alphabets (Vigenère cipher and Enigma machine)

A polyalphabetic cipher is any cipher based on substitution, using multiple

substitution alphabets. The Vigenère cipher is probably the best-known example of

a polyalphabetic cipher, though it is a simplified special case. The Enigma

machine is more complex but still fundamentally a polyalphabetic substitution

cipher.

The Alberti cipher by Leon Battista Alberti around 1467 was believed to be

the first polyalphabetic cipher. Alberti used a mixed alphabet to encrypt a message,

but whenever he wanted to, he would switch to a different alphabet, indicating that

he had done so by including an uppercase letter or a number in the cryptogram. For

this encipherment Alberti used a decoder device, his cipher disk, which

implemented a polyalphabetic substitution with mixed alphabets.

Although Alberti is usually considered the father of polyalphabetic cipher, it

has been claimed that polyalphabetic ciphers may have been developed by the Arab

cryptologist Al Kindi 600 years before Alberti. Johannes Trithemius in his

bookPolygraphiae libri sex (Six books of polygraphia), which was published in

1518 after his death invented a progressive keypolyalphabetic cipher called

the Trithemius cipher. Unlike Alberti's cipher, which switched alphabets at random

intervals, Trithemius switched alphabets for each letter of the message. He started

with a tabula recta, a square with 26 alphabets in it (although Trithemius, writing

Page 44: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 44 SJCET

in Latin, used 24 alphabets). Each alphabet was shifted one letter to the left from the

one above it, and started again with A after reaching Z (see image).

Fig 4.2: Tabula recta

Trithemius's idea was to encipher the first letter of the message using the first

shifted alphabet, so A became B, B became C, etc. The second letter of the message

was enciphered using the second shifted alphabet, etc. Alberti's cipher disk

implemented the same scheme. It had two alphabets, one on a fixed outer ring, and

the other on the rotating disk. A letter is enciphered by looking for that letter on the

outer ring, and encoding it as the letter underneath it on the disk. The disk started

with A underneath B, and the user rotated the disk by one letter after encrypting

each letter.

The cipher was trivial to break, and Alberti's machine implementation not

much more difficult. Key progression in both cases was poorly concealed from

attackers. Even Alberti's implementation of his polyalphabetic cipher was rather

easy to break (the capitalized letter is a major clue to the cryptanalyst). For most of

the next several hundred years, the significance of using multiple substitution

alphabets was missed by almost everyone. Polyalphabetic substitution cipher

Page 45: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 45 SJCET

designers seem to have concentrated on obscuring the choice of a few such

alphabets (repeating as needed), not on the increased security possible by using

many and never repeating any.

The principle (particularly Alberti's unlimited additional substitution

alphabets) was a major advance the most significant in the several hundred years

since frequency analysis had been developed. A reasonable implementation would

have been (and, when finally achieved, was) vastly harder to break. It was not until

the mid-19th century (in Babbage's secret work during the Crimean

War and Friedrich Kasiski's generally equivalent public disclosure some years

later), that cryptanalysis of well-implemented polyalphabetic ciphers got anywhere

at all.

4.3.1.1. Permutation cipher:

In classical cryptography, a permutation cipher is a transposition cipher in

which the key is a permutation.

To apply a cipher, a random permutation of size e is generated (the larger the

value of e the more secure the cipher). The plaintext is then broken into segments of

size e and the letters within that segment are permuted according to this key.

In theory, any transposition cipher can be viewed as a permutation cipher

where e is equal to the length of the plaintext; this is too cumbersome a

generalisation to use in actual practice, however.

4.3.1.2. Identifying the cipher:

Because the cipher doesn't change any of the characters, the ciphertext will

have exactly the same letter frequencies as the underlying plaintext. This means that

the cipher can in many cases be identified as a transposition by the close similarity

of its letter statistics with the letter frequencies of the underlying language.

4.3.1.3. Breaking the cipher:

Because the cipher operates on blocks of size e, the plaintext and the

ciphertext have to have a length which is some multiple of e. This causes two

weaknesses in the system: first, the plaintext may have to be padded (if the padding

is identifiable then part of the key is revealed ) and second, information relating to

the length of the key is revealed by the length of the ciphertext. To see this, note

Page 46: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 46 SJCET

that if the ciphertext is of length i then e must be one of the divisors of i. With the

different possible key sizes different possible permutations are tried to find the

permutation which results in the highest number of

frequent bigrams and trigrams as found in the underlying language of the plaintext.

Trying to find this permutation is essentially the same problem encountered when

analysing a columnar transposition cipher: multiple anagramming.

4.4. ENCRYPTION:

The process of converting plain text into cipher text is called Encryption

Encryption involves creating “shares” of the image which in a sense will be a

piece of the image.

In cryptography, encryption is the process of encoding messages or

information in such a way that only authorized parties can read it. Encryption does

not of itself prevent interception, but denies the message content to the

interceptor. In an encryption scheme, the message or information, referred to

as plaintext, is encrypted using an encryption algorithm, generating ciphertext that

can only be read if decrypted. For technical reasons, an encryption scheme usually

uses a pseudo-random encryption key generated by an algorithm. It is in principle

possible to decrypt the message without possessing the key, but, for a well-designed

encryption scheme, large computational resources and skill are required. An

authorized recipient can easily decrypt the message with the key provided by the

originator to recipients, but not to unauthorised interceptors.

They are two encryption keys

1. Symmetric key 2.public key encryptions

But we are not using keys where we are using shares.

Share generation

2 out of 2 scheme(4sub pixels)

• Each pixel encoded as

• a 2x2 cell

• in two shares

• Each share has 2 black, 2 white sub pixels

• When stacked, shares combine to

• Solid black

Half black (seen as gray)

Page 47: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 47 SJCET

4.4.1. IMPLEMENTATION:

Fig 4.3:Implementation of 2 out of 2 scheme

4.4.1.1. Uses of Encryption:

Encryption has long been used by militaries and governments to facilitate

secret communication. It is now commonly used in protecting information within

many kinds of civilian systems. For example, the Computer Security

Institute reported that in 2007, 71% of companies surveyed utilized encryption for

some of their data in transit, and 53% utilized encryption for some of their data in

storage. Encryption can be used to protect data "at rest", such as files on computers

and storage devices (e.g. USB flash drives). In recent years there have been

numerous reports of confidential data such as customers' personal records being

exposed through loss or theft of laptops or backup drives. Encrypting such files at

rest helps protect them should physical security measures fail. Digital rights

management systems, which prevent unauthorized use or reproduction of

copyrighted material and protect software against reverse engineering (see

also copy protection), is another somewhat different example of using encryption

on data at rest.

Encryption is also used to protect data in transit, for example data being

transferred via networks (e.g. the Internet, e-commerce), mobile

telephones, wireless microphones, wireless intercom systems, Bluetooth devices

Page 48: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 48 SJCET

and bank automatic teller machines. There have been numerous reports of data in

transit being intercepted in recent years. Encrypting data in transit also helps to

secure it as it is often difficult to physically secure all access to networks.

4.4.1.2. Message verification:

Encryption, by itself, can protect the confidentiality of messages, but

other techniques are still needed to protect the integrity and authenticity of a

message; for example, verification of a message authentication code (MAC) or

a digital signature. Standards for cryptographic software and hardware to perform

encryption are widely available, but successfully using encryption to ensure security

may be a challenging problem. A single error in system design or execution can

allow successful attacks. Sometimes an adversary can obtain unencrypted

information without directly undoing the encryption. See, e.g., traffic

analysis, TEMPEST, or Trojan horse.

Digital signature and encryption must be applied to the ciphertext when it is

created (typically on the same device used to compose the message) to avoid

tampering; otherwise any node between the sender and the encryption agent could

potentially tamper with it. Encrypting at the time of creation is only secure if the

encryption device itself has not been tampered with.

4.5. DECRYPTION:

The process of converting cipher text into plain text is called Decryption.

Decryption involving bringing together an appropriate combination and the human

visual system.

Decryption is the process of taking encoded or encrypted text or other data

and converting it back into text that you or the computer can read and understand.

This term could be used to describe a method of un-encrypting the data manually or

with un-encrypting the data using the proper codes or keys.

Data may be encrypted to make it difficult for someone to steal the

information. Some companies also encrypt data for general protection of company

data and trade secrets. If this data needs to be viewable, it may require decryption. If

a decryption passcode or key is not available, special software may be needed to

decrypt the data using algorithms to crack the decryption and make the data

readable.

Page 49: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 49 SJCET

Derived from the name of the mathematician Muhammed ibn-Musa Al-

Khowarizmi, an algorithm is a list of instructions, procedures, or formulas used to

solve a problem. Today, algorithms are used millions of times every day for a variety

of tasks. For example, an algorithm could look at an incoming e-mail to determine if

it is spam or a legitimate e-mail and discard only spam messages. Ada Lovelace is

credited as being the first person to develop an algorithm for a machine.

Decryption is the process of transforming data that has been rendered

unreadable through encryption back to its unencrypted form. In decryption, the

system extracts and converts the garbled data and transforms it to texts and images

that are easily understandable not only by the reader but also by the system.

Decryption may be accomplished manually or automatically. It may also be

performed with a set of keys or passwords.

One of the foremost reasons for implementing an encryption-decryption

system is privacy. As information travels over the World Wide Web, it becomes

subject to scrutiny and access from unauthorized individuals or organizations. As a

result, data is encrypted to reduce data loss and theft. Some of the common items

that are encrypted include email messages, text files, images, user data and

directories. The person in charge of decryption receives a prompt or window in

which a password may be entered to access encrypted information.

Decryption is the reverse process to Encryption. Frequently, the same Cipher

is used for both Encryption and Decryption. While Encryption creates a Ciphertext

from a Plaintext, Decryption creates a Plaintext from a Ciphertext.

Sender :The main function of the sender is it encrypts the plain text to cipher

text,that is in the human readable form.The examples of plain text is a text

document,an executable file or an image.

Receiver :The function of receiver is it decrypts the cipher text to plain text,that is

is the scrambled version of plain text and it is not understandable form.

Page 50: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 50 SJCET

CHAPTER-5

TOOL OUTLINE

5.1 Introduction to MATLAB:

MATLAB is a high-performance language for technical computing. It

integrates computation, visualization, and programming in an easy-to-use

environment where problems and solutions are expressed in familiar mathematical

notation. Typical uses include

Math and computation Algorithm development

Data acquisition

Modeling, simulation, and prototyping

Data analysis, exploration, and visualization

Scientific and engineering graphics

Application development, including graphical user interface building

MATLAB is an interactive system whose basic data element is an array that

does not require dimensioning. This allows you to solve many technical computing

problems, especially those with matrix and vecto formulations, in a fraction of the

time it would take to write a program in a scalar non-interactive language such as C

or Fortran. The name MATLAB stands for matrix laboratory. MATLAB was

originally written to provide easy access to matrix software developed by the

LINPACK and EISPACK projects. Today, MATLAB engines incorporate the

LAPACK and BLAS libraries, embedding the state of the art in software for matrix

computation. MATLAB has evolved over a period of years with input from many

users. In university environments, it is the standard instructional tool for introductory

and advanced courses in mathematics, engineering, and science. In industry,

MATLAB is the tool of choice for high productivity research, development, and

analysis. MATLAB features a family of add-on application-specific solutions called

toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn

and apply specialized technology. Toolboxes are comprehensive collections of

MATLAB functions (Mfiles) that extend the MATLAB environment to solve

particular classes of problems. Areas in which toolboxes are available include signal

Page 51: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 51 SJCET

processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and

many others.

The tutorials are independent of the rest of the document. The primarily

objective is to help you learn quickly the ¯rst steps. The emphasis here is “learning

by doing". Therefore, the best way to learn is by trying it yourself. Working through

the examples will give you a feel for the way that MATLAB operates. In this

introduction we will describe how MATLAB handles simple numerical expressions

and mathematical formulas.

The name MATLAB stands for MATrix LABoratory. MATLAB was written

originally to provide easy access to matrix software developed by the LINPACK

(linear system package) and EISPACK (Eigen system package) projects. MATLAB

is a high-performance language for technical computing. It integrates computation,

visualization, and programming environment. Furthermore, MATLAB is a modern

programming language environment: it has sophisticated data structures, contains

built-in editing and debugging tools, and supports object-oriented programming.

These factors make MATLAB an excellent tool for teaching and research.

MATLAB has many advantages compared to conventional computer

languages (e.g., C, FORTRAN) for solving technical problems. MATLAB is an

interactive system whose basic data element is an array that does not require

dimensioning. The software package has been commercially available since 1984

and is now considered as a standard tool at most universities and industries

worldwide. It has powerful built-in routines that enable a very wide variety of

computations. It also has easy to use graphics commands that make the visualization

of results immediately available. Specific applications are collected in packages

referred to as toolbox. There are toolboxes for signal processing, symbolic

computation, control theory, simulation, optimiza-tion, and several other fields of

applied science and engineering.

5.1.1. Basic features

As we mentioned earlier, the following tutorial lessons are designed to get you

started quickly in MATLAB. The lessons are intended to make you familiar with the

basics of MATLAB. We urge you to complete the exercises given at the end of each

lesson.

Page 52: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 52 SJCET

5.1.2. Starting MATLAB

After logging into your account, you can enter MATLAB by double-clicking

on the MATLAB shortcut icon (MATLAB 7.0.4) on your Windows desktop. When

you start MATLAB, a special window called the MATLAB desktop appears. The

desktop is a window that contains other windows. The major tools within or

accessible from the desktop are:

The Command Window

The Command History

The Workspace

The Current Directory

The Help Browser

The Start button

The MATLAB System -The MATLAB system consists of five main parts:

Development Environment. This is the set of tools and facilities that help you use

MATLAB functions and files. Many of these tools are graphical user interfaces. It

includes the MATLAB desktop and Command Window, a command history, an

editor and debugger, and browsers for viewing help, the workspace, files, and the

search path. The MATLAB Mathematical Function Library-this is a vast collection

of computational algorithms ranging from elementary functions like sum, sine,

cosine, and complex arithmetic, to more sophisticated functions like matrix inverse,

matrix eigenvalues, Bessel functions, and fast Fourier transforms. The MATLAB

Language- This is a highlevel matrix/array language with control flow statements,

functions, data structures, input/output, and object-oriented programming features. It

allows both "programming in the small" to rapidly create quick and dirty throw-away

programs, and "programming in the large" to create complete large and complex

application programs.

Graphics-MATLAB has extensive facilities for displaying vectors and

matrices as graphs, as well as annotating and printing these graphs. It includes high-

level functions for two-dimensional and three-dimensional data visualization, image

processing, animation, and presentation graphics. It also includes low-level functions

that allow you to fully customize the appearance of graphics as well as to build

Page 53: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 53 SJCET

complete graphical user interfaces on your MATLAB applications. The MATLAB

Application Program Interface (API). This is a library that allows you to write C and

Fortran programs that interact with MATLAB. It includes facilities for calling

routines from MATLAB (dynamic linking), calling MATLAB as a computational

engine, and for reading and writing MAT-files.

5.2 Language Description

5.2.1 The MATLAB System

The MATLAB system consists of five main parts:

5.2.2 Development Environment.

Development Environment Include the set of tools and facilities that help us

use MATLAB functions and files. Many of these tools are graphical user interfaces.

Mat lab by itself can be used as a calculator, where all the calculations are done at

the command prompt. Mat lab is an interactive system whose basic data element is

an array that does not require dimensioning. This allows you to solve many technical

computing problems, especially those with matrix and vector formulations, in a

fraction of the time it would take to write a program in a scalar non interactive

language such as C or FORTRAN. The name MATLAB stands for matrix

laboratory.

Page 54: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 54 SJCET

Figure 5.1: Basic view of Mat lab.

Mat lab is a copyright of Math Works Incorporation. The Math Works is

committed to making MATLAB as fast as 3GL programming languages, like C and

FORTRAN. The basic windows that help the user use Mat lab are five.

These five windows are to enable ease access and interaction with Mat lab.

These windows include,

The Command Window

Command history

Workspace Browser

Current Directory

Launch Pad

Apart from these windows, the main Matlab window is called The Matlab

desktop. If all the above shown windows are closed, then what we see is the Matlab

desktop. This window is the main window and opens when Matlab starts and closes

only when Matlab exists. In other words, exiting Matlab means closing or quitting

this Matlab desktop. The figure below shows how this Matlab desktop looks.

Page 55: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 55 SJCET

Fig 5.2 Matlab Desktop

This window is the main window but do not provide any access to Matlab

commands or functions. To interact with Matlab we need the first window ofthe

above listed windows, The Command window. Shown in figure3, is The Command

window. In the command window, we have the command prompt .This command

prompt is just like the dos prompt where we type all the commands so that Matlab

can understand the commands and give us the desired output. This is the point of

interaction between the user and Matlab. We type different commands at the

command prompt in the command window to execute our programs and achieve the

desired tasks.

Let us assume that we have a variable ‘a’, which has to hold the value

‘115’. So declare this variable, as we do in any other language, we say,

>> a=115 this statement declares the variable, a and assigns it the value 115.

Now declaring some more variables,

>> b=2 ; >> c=10;

Page 56: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 56 SJCET

Figure5.3: The Command Window

>> myvar=1001

>> var1=2001;

See the figure4 below and observe the difference between declaring the variables

using a semicolon (‘;’) at the end of the declaration.

Figure5.4: Variables

Page 57: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 57 SJCET

From the figure we can observe that, for the declarations made using the ‘;’,

there is no display of the variable and the value. And for those variables declared

without ‘;’, the variable and its corresponding value is displayed immediately after

the execution of the command (Any command is executed just by pressing the return

key.). To clear the command window, we use the command, >> clc this command

clears the command window. This is a basic command in Matlab.

Matlab is case-sensitive hence the command typed

>> a=115 is far different from the command

>> A=115 these two commands creates two variables, ‘a’ and assigns 115 and

‘A’ and assigns the value 115.

The next window in the above listed sequence is The Command History.

By its name we can say that it is nothing but the history of the commands typed at

the command prompt. See figure5 for the Command History.

Statements you enter in the Command Window are logged in the Command History.

All the statements we can see in the command history are the commands typed at the

command prompt. There is a time stamp at the beginning of the window, which

denotes the start of each session of Matlab.

Figure5.5: The Command History

The command history not only stores the Matlab commands but it also stores

everything what ever is typed at the command prompt. E.g.: the ‘abcdef’ in the

Page 58: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 58 SJCET

command history. This ‘abcdef’ is not a valid Matlab command but still is store in

the command history since it is typed at the command prompt. The next window is

The Workspace Browser. The MATLAB workspace consists of the set of variables

(named arrays) built up during a MATLAB session and stored in memory. You add

variables to the workspace by using functions, running M-files, and loading saved

workspaces. To view the workspace and information about each variable, use the

Workspace browser.

Figure5.6: Workspace Browser

5.3 Image Processing schemes

Image processing is referred to processing of a 2D picture by a computer.

Basic definitions: An image defined in the “real world” is considered to be a

function of two real variables, for example, a(x,y) with a as the amplitude (e.g.

brightness) of the image at the real coordinate position (x,y). Modern digital

technology has made it possible to manipulate multidimensional signals with

systems that range from simple digital circuits to advanced parallel computers. The

goal of this manipulation can be divided into three categories:

Image Processing (image in -> image out)

Image Analysis (image in -> measurements out)

Image Understanding (image in -> high-level description out)

Page 59: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 59 SJCET

Before going to processing an image, it is converted into a digital form.

Digitization includes sampling of image and quantization of sampled values. After

converting the image into bit information, processing is performed. This processing

technique may be, Image enhancement, Image reconstruction, and Image

compression

(a)Image Enhancement:

It refers to accentuation, or sharpening, of image features such as boundaries,

or contrast to make a graphic display more useful for display & analysis. This

process does not increase the inherent information content in data. It includes gray

level & contrast manipulation, noise reduction, edge crispening and sharpening,

filtering, interpolation and magnification, pseudo coloring, and so on.

(b)Image Restoration:

It is concerned with filtering the observed image to minimize the effect of

degradations. Effectiveness of image restoration depends on the extent and accuracy

of the knowledge of degradation process as well as on filter design. Image

restoration differs from image enhancement in that the latter is concerned with more

extraction or accentuation of image features.

(c)Image Compression:

It is concerned with minimizing the no of bits required to represent an image.

Application of compression are in broadcast TV, remote sensing via satellite,

military communication via aircraft, radar, teleconferencing, facsimile transmission,

for educational & business documents , medical images that arise in computer

tomography, magnetic resonance imaging and digital radiology, motion , pictures

,satellite images, weather maps, geological surveys and so on.

(d)Image representation

In MATLAB a binary and gray-scale image is represented by one 2-

dimensional array, whereas a color image are represented by a 3-dimensional array

(one 2-dimensional array for each of the color planes or color channels red, green

and blue):

Page 60: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 60 SJCET

Fig 5.7 Image representation

The origin of the image is in the upper left and the size of the image is

defined by the parameter width (number of columns of the array) and height (number

of rows of the array). Note that the x- and y-coordinates are chosen such that the z-

axis points to the front. A single point within the image is called pixel. A gray-scale

or binary pixel consists of one data value, a color pixel consists of 3 data values

(each for one of the color channels). The most common data types of the individual

pixels are:

uint8 unsigned integer: data range 0..255

double double precision float: data range 0.0 ... 1.0

Binary images have pixel values of 0’s and 1’s resp. 0.0 and 1.0. In the case

of uint8 images, the logical flag must be turned on, to be recognized as binary image.

5.4 . Why use MATLAB for Image Processing

Read and write many image file formats

Visualize and explore images interactively

Connect directly to cameras and frame grabbers

Use a large library of built-in functions

Quickly build custom image processing algorithms

Block-process large images to avoid memory issues

Process images faster with multiple cores and clusters

5.4.1. Working Formats In Matlab

If an image is stored as a JPEG-image on your disc we first read it into

Matlab. However, in order to start working with an image, for example perform a

Page 61: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 61 SJCET

wavelet transform on the image, we must convert it into a different format. This

section explains four common formats.

(a)Intensity image (gray scale image)

This is the equivalent to a "gray scale image" and this is the image we will

mostly work with in this course. It represents an image as a matrix where every

element has a value corresponding to how bright/dark the pixel at the corresponding

position should be colored. There are two ways to represent the number that

represents the brightness of the pixel: The double class (or data type). This assigns a

floating number ("a number with decimals") between 0 and 1 to each pixel. The

value 0 corresponds to black and the value 1 corresponds to white. The other class is

called uint8 which assigns an integer between 0 and 255 to represent the brightness

of a pixel. The value 0 corresponds to black and 255 to white. The class uint8 only

requires roughly 1/8 of the storage compared to the class double. On the other hand,

many mathematical functions can only be applied to the double class.

(b)Binary image

This image format also stores an image as a matrix but can only color a pixel

black or white (and nothing in between). It assigns a 0 for black and a 1 for white.

(c)Indexed image

This is a practical way of representing color images. (In this course we will

mostly work with gray scale images but once you have learned how to work with a

gray scale image you will also know the principle how to work with color images.)

An indexed image stores an image as two matrices. The first matrix has the same

size as the image and one number for each pixel. The second matrix is called the

color map and its size may be different from the image. The numbers in the first

matrix is an instruction of what number to use in the color map matrix.

(d)RGB image

This is another format for color images. It represents an image with three

matrices of sizes matching the image format. Each matrix corresponds to one of the

colors red, green or blue and gives an instruction of how much of each of these

colors a certain pixel should use.

Image information

imfinfo(’foo.ext’) - displays information on image format etc. of the

file foo.ext

Page 62: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 62 SJCET

imformats - displays an overview of all MATLAB image formats

whos img - displays information about the array img: size, data type,

etc

5.5 Basic functions of Image Processing in Matlab

5.5.1 Imread: Read image from graphics file

[X,map] = imread(filename,fmt) reads the indexed image in filename into X and its

associated colormap into map. The colormap values are rescaled to the range [0,1].

[...] = imread(filename) attempts to infer the format of the file from its content.

5.5.2 Imshow: Display an image

imshow(I,n) displays the intensity image I with n discrete levels of gray. If

you omit n, imshow uses 256 gray levels on 24-bit displays, or 64 gray levels on

other systems.

imshow(I,[low high]) displays I as a grayscale intensity image, specifying the data

range for I. The value low (and any value less than low) displays as black; the value

high (and any value greater than high) displays as white. Values in between are

displayed as intermediate shades of gray, using the default number of gray levels. If

you use an empty matrix ([]) for [low high], imshow uses [min(I(:)) max(I(:))]; that

is, the minimum value in I is displayed as black, and the maximum value is

displayed as white.

imshow(BW) displays the binary image BW. imshow displays pixels with the value

0 (zero) as black and pixels with the value 1 as white.

imshow(X,map) displays the indexed image X with the colormap map.

imshow(RGB) displays the true-color image RGB.

imshow(...,display_option) displays the image, where display_option specifies how

imshow handles the sizing of the image. display_option is a string that can have

either of these values.

Page 63: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 63 SJCET

CHAPTER-6

RESULT OBSERVATION

6.1. Simulation Results:

Fig 6.1: secret image

Here we are using secret image is in bitmap format

which is in the understandable form.

A bitmap is a type of memory organization or image file format used to

store digital images. The term bitmap comes from the computer

Page 64: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 64 SJCET

programming terminology, meaning just a map of bits, a spatially mapped array of

bits.

Fig 6.2 : share1& share2

With random selection of pixels from secret image, share 1& share 2 are formed.

Page 65: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 65 SJCET

Fig 6.3: overlapped image

When stacking of these two shares then this overlapped image was formed.

Due to random selection of pixels from secret image, output image is

decoded by superimposing the two shares with 50% loss of contrast.

The decoded image is identified, although some contrast loss is observed.

Due to pixel expansion the width of the decoded image is twice as that of the original

image.

Hence, we want to enhance the visual quality of decoded image.

So, it will be implemented by using Gaussian kernel filter.

In electronics and signal processing, a Gaussian filter is

a filter whose impulse response is a Gaussian function (or an approximation to it).

Gaussian filters have the properties of having no overshoot to a step function input

while minimizing the rise and fall time. This behavior is closely connected to the fact

that the Gaussian filter has the minimum possible group delay. It is considered the

Page 66: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 66 SJCET

ideal time domain filter, just as the sinc is the ideal frequency domain filter. These

properties are important in areas such as oscilloscopes

and digital telecommunication systems.

Mathematically, a Gaussian filter modifies the input signal

by convolution with a Gaussian function; this transformation is also known as

the Weierstrass transform.

Fig 6.4: screen shot of menu button required to generate enhanced image

Fig 6.5: screen shot of clear decrypted enhanced image

Page 67: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 67 SJCET

display quality of output is low

Fig 6.6: Enhanced output image good visible output

Above image is visible if its size is larger ,other wise its size is small the

Information in image cannot be visible to us.

Page 68: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 68 SJCET

CHAPTER-7

CONCLUSION AND FUTURE SCOPE

7.1. Conclusion :

The existing system the dealer or sender takes a secret image and encodes

into shares. After encoding this shares are sent to participants. The receiver collects

the shares and stack to get decoded secret image. Here no verification is done so

easy cheating is done. In this paper we proposed a system such that the dealer or

sender takes one secret image and verification image. These two images are encoded

into shares, after encoding sends one secret share and one verification share to the

participants. Each participant verifies the share and other participant secret share

reveals the secret image. In this way cheating is avoided.

In this paper we have proposed a technique of well known secret sharing on both

black and white and color images. At the time of dividing an image into n number of

shares we have used random number generator, which is a new technique not

available till date. This technique needs very less mathematical calculation compare

with other existing techniques of visual cryptography on color images. This technique

only checks ‘1’ at the bit position and divide

that ‘1’ into (n-k+1) shares using random numbers. In most of our experimental

results, each share reflects very little or even no information regarding the original

image to human eye.

But the main drawback of the algorithm is in its number of loops. For n=6, k=5 and a

32 bit pixel with 50% ‘1’, number of loop operation required is 32. For n=6, k=4

with other conditions same, number of loop operation required is 48. For n=6, k=3

with other conditions same, number of loop operation required is 64.

7.2. Future Scope :

Visual cryptography technique is used to make the data secure. Here the

original data is divided into a number of shares which are sent through different

communication channels from sender to receiver. Therefore the intruder has less

chance to get the whole information. But still it is not so secured. This can be made

more secure by introducing a symmetric key for both encryption and decryption

Page 69: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 69 SJCET

process. Using the key, the image is first encrypted then divided into a number of

shares. If the intruder gets k number of shares s/he cannot be able to decrypt it if the

key is not known to his/her. For key, a combination of character or number can be

used. The change of higher bits make the image more blur, so the key can be applied

on the higher bits of each pixels. A small image can also be used as a key. Let an

image with size w1 X h1 is taken as a key where w1<w and h1<h. The original

image is divided into blocks of w1 X h1. For each block, (w1, h1) th pixel is

encoded with (w1, h1) th pixel of the key image. The reverse process will be applied

for decryption.

Page 70: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 70 SJCET

CHAPTER 8

BIBILIOGRAPHY

8.1. REFERENCES :

(1) International Journal Of Engineering And Computer Science ISSN:2319-7242 Volume 2 Issue 1 Jan 2013 Page No. 265-303 Secure Visual Cryptography R

Yadagiri Rao.

[1] M.Naor and A.Shamir, "Visual Cryptography", in Proc.EUROCRYPT, 1994,

pp.1-12

[2] [E. R. Verheul and H. C. A. v. Tilborg, Constructions and properties of k-out-of-

n visual secret sharing schemes, Designs Codes Crypto., vol. 11, pp. 179_196, 1997

[3] A. Adhikari and S. Sikdar, A new (2, n)-visual threshold scheme for color images

in Proc. INDOCRYPT 2003, Berlin, Germany, 2003

[4] C. Blundo, P. D'Arco, A. D. Santis, and D. R. Stinson, Contrast optimal threshold

visual cryptography schemes”SIAMJ Discrete Math., vol. 16, pp. 224_261, 2003

[5] C. N. Yang, New visual secret sharing schemes using probabilistic

method,Pattern Recognit. Lett., vol. 25, pp. 481_494, 2004

[6] C. Blundo, S. Cimato, and A. D. Santis,Visual cryptography schemes with

optimal pixel expansion, Theor. Comput. Sci., vol. 369, pp. 169_182, 2006

[7] P. L. Chiu and K.H.Lee,A simulated annealing algorithm for general threshold

visual cryptography schemes IEEE Trans. Inf. Forenics Security, vol. 6,Sep. 2011

[8] Mizuho Nakajima,Yasushi yamaguchi,university of Tokyo,Extended visual

cryptography for natural images

[9] G. Ateniese, C. Blundo, A. D. Santis, and D. R. Stinson, Visual

cryptography for general access structures, Inform. Comput., vol.

129, pp.86_106, 1996

[10] Kai-Hui-Lee and Pei-Ling-chui,An extended visual cryptographic algorithm for

general access structures,IEEE February 2012

[11] InKoo Kang,Gonzalo R.Arce,heung-Kyu Lee, Color Extended Visual

Cryptography Using Error Diffusion, IEEE Trans. On Image processing,vol.20

Page 71: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 71 SJCET

[12] Feng Liu,Chuankun Wu, and Xijun Lin, _Step Construction of visual

cryptography schemes, IEEE Transactions On Information Forensics And Security,

Vol. 5, No. 1,March 2010

[13] Pankaja Patil , Bharati Pannyagol ,Visual Cryptography for color

images using Error diffusion and Pixel synchronization,International Journal of

Latest Trends in Engineering and Technology (IJLTET), Vol. 1 Issue 2 July 2012

[14] Dr.D.Vasumathi ,M.Surya Prakash Rao, M.Upendra Kumar,

Dr.Y.Ramadevi,Dr.R.Rajeswara Rao, Novel Approach for Color Extended Visual

Cryptography Using Error Diffusion,International Journal of Computer Trends and

Technology vol.3 Issue4-2012

[15] Nitty Sarah Alex,L. Jani Anbarasi, Enhanced Image Secret Sharing via Error

Diffusion in Halftone Visual Cryptography,2011 IEEE

[16] Anuprita Mande, Manish Tibdewal , A Fast Encryption Algorithm for Color

Extended Visual cryptography,International Journal of Emerging Technology and

Advanced Engineering,Volume 3, Issue 4, April 2013

[17] Prof.S.S.Asole, Ms. S.M.Mundada,_Securing Databases from Unauthorized

Users ,International Journal of Advancements in Research & Technology, Volume 2,

Issue4, April-2013

[18] Chandramathi S, Ramesh Kumar R., Suresh R and Harish S, An overview of

visual cryptography, International Journal of Computational Intelligence Techniques

Page 72: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 72 SJCET

8.2. APPENDIX A:

(a) MAIN PROGRAM SOURCE CODE:

%Program for Construction of a two-out-of-two Visual Cryptography Scheme

%Program Description

%This program is the main entry of the application.

%This program generates a two-out-of-two Visual Cryptography Scheme shares.

%The input image for this program should be a binary image.

%The shares and the overlapping result of the shares are written as output.

%The Shares (1 & 2) can be printed in separate transparent sheets and overlapping

them

%reveals the secret image.

%Clear Memory & Command Window

clc;

clear all;

close all;

%Read Input Binary Secret Image

inImg = imread('batch6.bmp');

figure;imshow(inImg);title('Secret Image');

%Visual Cryptography

[share1, share2, share12] = VisCrypt(inImg);

%Outputs

figure;imshow(share1);title('Share 1');

figure;imshow(share2);title('Share 2');

figure;imshow(share12);title('Overlapping Share 1 & 2');

imwrite(share1,'Share1.bmp');

imwrite(share2,'Share2.bmp');

imwrite(share12,'Overlapped.bmp');

(b) SOURCE CODE FOR GENERATING SHARES:

%Program for random permuting the share generation

%Program Description

%This program generates the share 1 & share 2 randomly for each pixel.

function out = generateShare(a,b)

Page 73: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 73 SJCET

a1 = a(1);

a2 = a(2);

b1 = b(1);

b2 = b(2);

in = [a b];

out = zeros(size(in));

randNumber = floor(1.9*rand(1));

if (randNumber == 0)

out = in;

elseif (randNumber == 1)

a(1) = a2;

a(2) = a1;

b(1) = b2;

b(2) = b1;

out = [a b];

end

(c) SOURCE CODE FOR CONSTRUCTION OF VCS:

%Program for Construction of a two-out-of-two Visual Cryptography Scheme

%Program Description

%This program generates a two-out-of-two Visual Cryptography Scheme shares.

%The input image for this program should be a binary image.

%The shares and the overlapping result of the shares are written as output.

%Usage:

%Input: inImg - A binary image

%Output: share1 - Generated share 1

% share2 - Generated share 2

% share12 - Overlapped result of shares 1 & 2

function [share1, share2, share12] = VisCrypt(inImg)

s = size(inImg);

share1 = zeros(s(1), (2 * s(2)));

Page 74: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 74 SJCET

share2 = zeros(s(1), (2 * s(2)));

%%White Pixel Processing

%White Pixel share combinations

disp('White Pixel Processing...');

s1a=[1 0];

s1b=[1 0];

[x y] = find(inImg == 1);

len = length(x);

for i=1:len

a=x(i);b=y(i);

pixShare=generateShare(s1a,s1b);

share1((a),(2*b-1):(2*b))=pixShare(1,1:2);

share2((a),(2*b-1):(2*b))=pixShare(2,1:2);

end

%Black Pixel Processing

%Black Pixel share combinations

disp('Black Pixel Processing...');

s0a=[1 0];

s0b=[0 1];

[x y] = find(inImg == 0);

len = length(x);

for i=1:len

a=x(i);b=y(i);

pixShare=generateShare(s0a,s0b);

share1((a),(2*b-1):(2*b))=pixShare(1,1:2);

share2((a),(2*b-1):(2*b))=pixShare(2,1:2);

end

share12=bitor(share1, share2);

share12 = ~share12;

disp('Share Generation Completed.');

Page 75: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 75 SJCET

(d) SOURCE CODE FOR ENHANCING THE IMAGE:

clc; % Clear the command window.

close all; % Close all figures (except those of imtool.)

clear; % Erase all existing variables. Or clearvars if you want.

workspace; % Make sure the workspace panel is showing.

format long g;

format compact;

fontSize = 20;

% Check that user has the Image Processing Toolbox installed.

hasIPT = license('test', 'image_toolbox');

if ~hasIPT

% User does not have the toolbox installed.

message = sprintf('Sorry, but you do not seem to have the Image Processing

Toolbox.\nDo you want to try to continue anyway?');

reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');

if strcmpi(reply, 'No')

% User said No, so exit.

return;

end

end

% Read in a standard MATLAB gray scale demo image.

folder = fullfile(matlabroot, '\toolbox\images\imdemos');

button = menu('Click on the button to generate Enhanced decrypted image',

'Decrypted image' );

if button == 1

baseFileName = 'outputbatch6.bmp';

end

% Read in a standard MATLAB gray scale demo image.

folder = fullfile(matlabroot, '\toolbox\images\imdemos');

% Get the full filename, with path prepended.

fullFileName = fullfile(folder, baseFileName);

% Check if file exists.

if ~exist(fullFileName, 'file')

% File doesn't exist -- didn't find it there. Check the search path for it.

Page 76: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 76 SJCET

fullFileName = baseFileName; % No path this time.

if ~exist(fullFileName, 'file')

% Still didn't find it. Alert user.

errorMessage = sprintf('Error: %s does not exist in the search path folders.',

fullFileName);

uiwait(warndlg(errorMessage));

return;

end

end

grayImage = imread(fullFileName);

% Get the dimensions of the image.

% numberOfColorBands should be = 1.

[rows, columns, numberOfColorBands] = size(grayImage);

if numberOfColorBands > 1

% It's not really gray scale like we expected - it's color.

% Convert it to gray scale by taking only the green channel.

grayImage = grayImage(:, :, 2); % Take green channel.

end

% Display the original gray scale image.

subplot(2, 2, 1);

imshow(grayImage, []);

axis on;

title('Original decoded Image', 'FontSize', fontSize);

% Enlarge figure to full screen.

set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);

% Give a name to the title bar.

set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')

% Create a blurring kernel.

kernel = fspecial('Gaussian', 32, 8);

subplot(2, 2, 2);

imshow(kernel, []);

axis on;

title('Gaussian Blur Kernel', 'FontSize', fontSize);

% Blur the image.

Page 77: ENHANCED VISUAL CRYPTOCRAPHY

ENHANCED VISUAL CRYPTOGRAPHY USING MATLAB

Dept of ECE 77 SJCET

blurred = imfilter(grayImage, kernel, 'replicate');

subplot(2, 2, 3);

imshow(blurred);

axis on;

title('Enhanced output Image', 'FontSize', fontSize);