0% found this document useful (0 votes)
324 views45 pages

Thesis - Project Report

This document describes a project on image text color code cryptography. It discusses existing cryptographic systems and their issues. It then proposes a system that encrypts an image by converting it to text format using color codes. The key steps involve preprocessing the image, encrypting the data, encoding it using colors, compressing it using Huffman encoding, and generating a color coded image. The system is implemented using tools like MATLAB and C#. Various testing techniques like unit testing and integration testing are used to test the system modules and functionality.

Uploaded by

jay patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
324 views45 pages

Thesis - Project Report

This document describes a project on image text color code cryptography. It discusses existing cryptographic systems and their issues. It then proposes a system that encrypts an image by converting it to text format using color codes. The key steps involve preprocessing the image, encrypting the data, encoding it using colors, compressing it using Huffman encoding, and generating a color coded image. The system is implemented using tools like MATLAB and C#. Various testing techniques like unit testing and integration testing are used to test the system modules and functionality.

Uploaded by

jay patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 45

IMAGE TEXT COLOR CODE CRYPTOGRAPHY

A MINOR PROJECT REPORT

Submitted by

B.TARUN REDDY [Reg No:RA1411003020045]


SHRAVANI BADADHA [Reg No:RA1411003020050]
K K DHRUTHI [Reg No:RA1411003020053]

Under the guidance of


Mr.MANIRAJ S.P.
(Asst. Professor, Department of Computer Science & Engineering)
BACHELOR OF TECHNOLOGY
in

COMPUTER SCIENCE & ENGINEERING


of

FACULTY OF ENGINEERING AND TECHNOLOGY

Ramapuram,Chennai,600089
MAY 2017
SRM UNIVERSITY
(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified that this project report titled IMAGE TEXT COLOR CODE
CRYPTOGRAPHY is the bonafide work of B.TARUN REDDY
[Reg No:RA1411003020045], SHRAVANI BADADHA [Reg No:RA14110030200
K K DHRUTHI [Reg No:RA1411003020053], , , who carried out the
project work under my supervision. Certified further, that to the best of
my knowledge the work reported herein does not form any other project
report or dissertation on the basis of which a degree or award was con-
ferred on an earlier occasion on this or any other candidate.

SIGNATURE SIGNATURE

Mr.MANIRAJ S.P. Dr. JAGADEESAN,M.Tech.,Ph.D.,


GUIDE HEAD OF THE DEPARTMENT
Asst. Professor Dept. of Computer Science & Engi-
Dept. of Computer Science & Engi- neering
neering

Signature of the Internal Examiner Signature of the External Examiner


ABSTRACT

Color coded encryption is a technique of implementing a symmetrical

system for security purpose. It is implemented by encryption of image

by converting into text format. Data encryption refers to mathematical

calculation and algorithmic schemes that transforms plain image into ci-

pher image. The recipient of an encrypted image which triggers the al-

gorithmic mechanism to decrypt the image to the original version. The

data is converted into code which is considered as an algorithm which

uniquely color padded code from the converted medium binary code. In

RGB(Red, Green, Blue) color mode a pixel is represented by 24 bits in

which 8 bit represent the intensity of each color. The Huffman encoding

technique works by creating a binary tree of nodes. These can be stored

in a regular array. As a common convention, bit 0 represents following

the left child and bit 1 represents following the right child. Huffman tree

that omits unused symbol produces the most optimal code length. The

technique is responsible for generating an image from an image file, it

does this by first compressing the file using Huffman encoding. Later it

results in the color coded image. It decrypts the image and gives back

the encoded vector.


TABLE OF CONTENTS

ABSTRACT iii

LIST OF TABLES vii

LIST OF FIGURES viii

1 INTRODUCTION 1
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Organisation of the report . . . . . . . . . . . . . . . . . . . . . . . 2

2 SYSTEM ANALYSIS AND DESIGN 4


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Existing Cryptographic System . . . . . . . . . . . . . . . . . . . . 4
2.2.1 Traditional Symmetric-Key Ciphers . . . . . . . . . . . . . 4
2.2.2 Modern Symmetric-Key Ciphers . . . . . . . . . . . . . . . 4
2.2.3 Digital Color Image Encryption Using RC4 Stream Cipher and
Choatic Logistic Map . . . . . . . . . . . . . . . . . . . . . 5
2.2.4 Image Encryption Using Affine Transform and XOR operation 5
2.2.5 Image Encryption based on Explosive n*n Block Displacement
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . 5
2.3 Issues in existing systems . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Proposed System . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6 System Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 Description procedure for color code encryption . . . . . . . . . . . 8
2.7.1 Data Encryption . . . . . . . . . . . . . . . . . . . . . . . 8
2.7.2 ASCII-based encoding using colors . . . . . . . . . . . . . 9
2.7.3 Lossless compression . . . . . . . . . . . . . . . . . . . . . 9

iv
2.7.4 Huffman Encoding . . . . . . . . . . . . . . . . . . . . . . 9
2.7.5 Huffman Code Complexity . . . . . . . . . . . . . . . . . . 10
2.8 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.8.1 Hardware Specifications . . . . . . . . . . . . . . . . . . . 11
2.8.2 Software Specifications . . . . . . . . . . . . . . . . . . . . 11
2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 MODULE DESCRIPTION 12
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 List of modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.1 Image input . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.2 Image preprocessing . . . . . . . . . . . . . . . . . . . . . 13
3.3.3 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.4 Decryption . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.5 Implementation . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.6 Quadtree Decomposition . . . . . . . . . . . . . . . . . . . 15
3.3.7 Conversion of Colors to Binary Form . . . . . . . . . . . . 16
3.3.8 Compression of image . . . . . . . . . . . . . . . . . . . . 17
3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4 SYSTEM IMPLEMENTATION 19
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2 Overview of the Platform . . . . . . . . . . . . . . . . . . . . . . . 19
4.2.1 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2.2 C#.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2.3 JAVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.3 Implementation Details . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3.1 Sample Coding . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3.2 Convert Image to Text . . . . . . . . . . . . . . . . . . . . 23
4.3.3 Huffman Encoding . . . . . . . . . . . . . . . . . . . . . . 24
4.3.4 Huffman Decoding . . . . . . . . . . . . . . . . . . . . . . 26

v
4.3.5 Screenshots . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5 SYSTEM TESTING 30
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.2 Types of Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2.1 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2.2 Integration Testing . . . . . . . . . . . . . . . . . . . . . . 32
5.2.3 User Acceptance Testing . . . . . . . . . . . . . . . . . . . 32
5.2.4 Test Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.3 Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3.1 Test Objective . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3.2 Test Result . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3.3 Performance Testing . . . . . . . . . . . . . . . . . . . . . 34
5.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

6 CONCLUSION 35

7 FUTURE ENHANCEMENT 36

8 REFERENCES 37

vi
LIST OF TABLES

5.1 Comparison of Expected and Actual Outputs . . . . . . . . . . . 33


5.1 Comparison of Expected and Actual Outputs . . . . . . . . . . . 34

vii
LIST OF FIGURES

2.1 Architecture of Proposed System . . . . . . . . . . . . . . . . . . 8

3.1 Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 UML diagram of image input . . . . . . . . . . . . . . . . . . . . 13
3.3 UML diagram of image pre-processing . . . . . . . . . . . . . . 13
3.4 UML diagram for encryption . . . . . . . . . . . . . . . . . . . . 14
3.5 UML diagram for decryption . . . . . . . . . . . . . . . . . . . . 14
3.6 Working concept of color mapping . . . . . . . . . . . . . . . . . 15
3.7 Block representation of Quadtree decomposition . . . . . . . . . 16
3.8 Colors and its Hexadecimal values . . . . . . . . . . . . . . . . . 17
3.9 Compression of image . . . . . . . . . . . . . . . . . . . . .. . 18

4.1 Main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


4.2 Image Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3 Image Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.5 Decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

viii
CHAPTER 1

INTRODUCTION

1.1 Overview

Color Coded Encryption is a technique of implementing a symmetrical system for se-


curity purpose. The symmetrical system is implemented by encryption of image to
hexadecimal text by loseless text compression technique and later converting it into
color code image format. Image is divide into fine grids of little square .Each square
has a specific uniform color and thus the squares are called as pixels.Each pixels has a
color and is represents each pixel with a number. The most image file formats employ
an additional step called compression.To reduce the size of the image file, compression
algorithms are to be implemented at the encryption stage.In RGB(Red, Green, Blue)
color mode a pixel is represented by 24 bits in which 8 bit represent the intensity of
each color. The Huffman encoding technique works by creating a binary tree of nodes.
These can be stored in a regular array. As a common convention, bit 0 represents fol-
lowing the left child and bit 1 represents following the right child. Huffman tree that
omits unused symbol produces the most optimal code length. The converse process is
used to generate at the destination system to recover the data in the original format. In-
formation security is the protection of information and minimises the risk of exposing
information to unauthorised parties from disclosure, modification, and destruction of
data. Cryptography is a method of storing and transmitting data in a particular form
so that only for whom it is intended can read and process it. The security of image
is totally dependent on two things: the power of the cryptographic algorithm and the
confidentiality of the key. Many researchers have modified the existing algorithms to
fulfill the need in the current market, yet the ciphers are vulnerable to attacks.
1.2 Objective

Data encryption technique converts data into a unreadable format so as to protect the
information from external intrusion.It is thus useful in ensuring the privacy and security
of the information transferred or shared between the systems.The need for encryption
of the images directly because of two reasons are due to the following reasons due to
The size of image is often larger than text. Hence traditional encryption algorithms
take larger time to encrypt and decrypt images compared to text. second one is due
to the text encryption both decrypted and original text must be equal. This condition
is never true for images.Because due to human perception; decrypted image with small
distortion is usually acceptable Text compression algorithms can be used to compact the
text stored in the file and reduce the size of the file. It helps to reduce the consumption
of resources, such as hard disk space or transmission bandwidth. Here, we propose
a color coding scheme that can be used for data encryption which represents text in
the form of colored blocks by grouping together binary bits and assigning them colors
along with Huffman encoding scheme which is used for lossless text compression. The
additional step compression is done due to find ways of using less bits and that can be
achieved only through this important function called compression.JPEG,png,gif,files
utilises various such compression schemes.The main idea of quadtree decomposition is
to divide the image into blocks which tells about the structure of the image.The main
perspective of quadtree decomposition is to divide the images in equally sized block till
it reaches homogeneity.Thus output results in color coded blocks which is difficult to
decrypt without the knowledge of the user.

1.3 Organisation of the report

The project which mainly focuses on the image to text color coded cryptography. There
are five chapters that deal with the various design and implementation details

2
chapter 1

This chapter deals on the objective and overview of the project.

Chapter 2

This chapter includes all the features of the existing system and the proposed system
architecture and the the flow of process. Design of the entire project is done.

Chapter 3

This chapter includes the various modules involved in the project and the architecture
of the entire system. The working of various modules is explained with description.

Chapter 4

This chapter entirely deals about the system implementation on the details about the
platform used and the implementation source code and screen shots of the output pro-
duced.

Chapter 5

This chapter deals with system testing objective of identifying and correcting deviations
from standards, identifying and fixing logical bugs and fall through and recording code
walk through findings after successful completion.

Chapter 6

This chapter deals with the conclusion of the project.

3
CHAPTER 2

SYSTEM ANALYSIS AND DESIGN

2.1 Introduction

The history of the cryptographic systems take back to a long way. There are various
methods of existing cryptography. Though many of them are not efficient enough,
very powerful cryptographic methods are being used currently. The proposed system
is derived by reviewing various preceding methods. In this analysis and design of the
system is explained in detail.

2.2 Existing Cryptographic System

2.2.1 Traditional Symmetric-Key Ciphers

In symmetric key ciphers, plain text is converted into cipher-text using a shared secret
key and an encryption algorithm. Using the same key and a decryption algorithm, the
plain text is recovered from the cipher- text. The Secret Key is shared by both, the
sender and the receiver which they must have obtained in a secure fashion should keep
the key hidden.

These ciphers consist of Substitution and Transposition ciphers. A Substitution


cipher replaces one symbol with another. A Transposition cipher re-orders the symbols.

2.2.2 Modern Symmetric-Key Ciphers

A symmetric-key modern block cipher encrypts an n-bit block of plain text or decrypts
an n-bit block of cipher-text. The encryption or decryption algorithm uses a k-bit key.

A modern block cipher can be designed to act as a substitution cipher or a transpo-


sition cipher DES and AES are examples of this type of cryptography algorithm.
2.2.3 Digital Color Image Encryption Using RC4 Stream Cipher
and Choatic Logistic Map

The technique consists of three stages .In the first stage,system converts the external key
into initial value.Afterwards,in the second stage,the technique applies the initial value
to the choatic logistic map for engendering a pseudo random number. Afterward,in
the third stage,the system XOR the byte stream of the plain image with the stream of
pseudo random number for the encryption.Experimental outcomes of this algorithm
validate that the decryption process is the highly key sesitive

RSA and Merkle Hellman knapsack crypto system is the most commonly used
asymmetric key algorithm. The security of RSA relies on the difficulty of factoring
large integers.

2.2.4 Image Encryption Using Affine Transform and XOR opera-


tion

This technique applies 64 bits key in the encryption. The designed technique operates
the affine transformation to dispel the pixels by applying four sub keys of 8 bits there
after the algorithm decomposes an image into 2*2 pixel block size and afterwards ap-
plies a XOR operation on each block with four sub keys of 8 bits to modify pixel value.
the presented method is less effective in reducing the correlation between pixels and
also has short key space.

2.2.5 Image Encryption based on Explosive n*n Block Displace-


ment

The technique uses the transformation algorithm to minimize the correlation between
pixels.Imparted technique consists of two stages.At first stage algorithm performs horizan-
tal block displacement followed by vertical block displacement.In second stage the
technique perrforms inter pixel displacemet of RGB values.

5
2.3 Issues in existing systems

RSA is working on the base of multiplication of two prime numbers. Therefore, num-
ber factorization is a serious threatening against RSA and currently different kinds of
attacks have identified against RSA by cryptanalysis. Most attacks appear to be the
result of misuse of the system or bad choice of parameters.

A well-known attack on RSA can break the RSA in 953 milliseconds of length with
180 digits, where n is the product of two unequal prime numbers [6]&[10].

Substitution techniques like Caesar Cipher, Mono alphabetic Cipher, Play fair Ci-
pher and Poly alphabetic Ciphers are not strong enough since they are vulnerable to
brute-force attacks.

2.4 Problem Statement

The problem definition is to design a system capable of performing lossless data com-
pression on binary data using encryption and decryption.It should also function as a
solution to the data protection needs of the user,holding a significant role in environ-
ments where privacy of data is critical thus contributing to information security.The en-
coding and compressing schemes need to be computationally and functionally efficient
and must look up to provide an optimal solution to the above mentioned problems.The
system must be capable of taking input in the form of image files whose binary rep-
resentation is processed and thereby encrypted in a color image .Appropriate Huffman
encoding are used on encrypted data to ensure a suitable trade-off between the tasks
performed and space complexities issues involved. The design should achieve the best
possible compression ratio,with the limited resources of a present day PC.As a result,
there are strict constraints on the memory usage and compression speed of the design
.The system aims to work with text file in standard ASCII based format .The this tech-
nique compresses the file using Huffman encoding and then encodes the binary file data
into a color code encrypted JPEG,PNG image file.

6
2.5 Proposed System

The project is proposed to design a system capable of performing lossless data com-
pression on binary data using encryption and decryption. It should also function as a
solution to the data protection needs of the user, holding a significant role in environ-
ments where privacy of data is critical thus contributing to information security. The
encoding schemes need to be computationally and functionally efficient and must look
up to provide an optimal solution to the above mentioned problems. The system must
be capable of taking input in the form of image files whose binary representation is
processed based on ASCII values of hexadecimal text and there by encrypted in a color
code blocks image. Appropriate Huffman encoding are used on the encrypted data to
ensure a suitable trade-off between the tasks performed and space complexity issues in-
volved. The design should achieve the best possible compression ratio, with the limited
resources of a present day PC.As a result, there are strict constraints on the memory
usage and the compression speed of the design. The system presently aims to work
with image file in standard ASCII-based format.

The compressed text is then converted into binary code from the hexadecimal. These
binary bits are grouped together and mapped with the color patterns, unique for each
code, and then the final combinations of all the colors is represented as a .png image.

The proposed system works using the technique which encodes the file using Huff-
man encoding and later the binary file data into a color code encrypted PNG image
file. While it does the reverse on decryption side which later decrypts the text back to
original PNG image.

7
Figure 2.1: Architecture of Proposed System

2.6 System Architecture

2.7 Description procedure for color code encryption

2.7.1 Data Encryption

Data encryption refers to mathematical calculations and algorithmic schemes that trans-
form image to hexadecimal bits using ASCII based format.Image is divided into fine
grids of little square .Each square has a specific uniform color and thus the squares are
called as pixels.Each pixels has a color and is represents each pixel with a number. The
most image file formats employ an additional step called compression.To reduce the
size of the image file, compression algorithms are to be implemented at the encryption
stage. It is done by dividing an ,a form that is non-decipherable to unauthorized parties.

The recipient of an encrypted message uses a predefined functions which triggers


the algorithm mechanism to decrypt the data, transforming it to the original version.

8
2.7.2 ASCII-based encoding using colors

The method of ASCII-based encoding scheme using colors based upon the pixels of
the image. In RGB-256 color mode, a pixel is represented by 24 bits, in which 8 bits
represent the intensity of each color. For example, a color (80, 121, 150) is represented
as (01010000 01111001 10010110) implemented. Taking the first 8 bits i.e. in this case,
01010000: ignoring the MSB bit, the remaining 7 bits or first 128 parts of the color is
used to denote a character in the ASCII table. In this way, three different characters
can be denoted by a single color. Thus, a text document is converted into an encoded
file filled with colored dots. By using the above concepts of encoding, large amounts
can be compressed and transmitted in a more secured way. This concept of ASCII-
based method for representing characters and encoding them into colors is used in the
proposed system.

2.7.3 Lossless compression

Portable network graphics ia a raster graphic file format that supports lossless data com-
pression requires that the combination of compression and decompression methods to
be lossless, or else the data cannot be restored in original format. This technique is
done when the image contains a quite a lot of pixels there to reduce the size of the im-
age losless image compression is done where we use less pits per image .The design of
data compression schemes involves trade-offs among various factors, including the de-
gree of compression, the amount of distortion introduced (if using a lossy compression
algorithm), and the computational resources required to compress and uncompress the
data.

2.7.4 Huffman Encoding

The Huffman encoding technique works by creating a binary tree of nodes. These can
be stored in a regular array, the size of which depends on the number of symbols, n. It
is loss less data compression where the idea is to assign variable length code to input
character where it depends on frequencies wavelength. A node can be either a leaf

9
node or an internal node. Initially, all nodes are leaf nodes, which contain the symbol
itself, the weight (frequency of appearance) of the symbol and optionally, a link to a
parent node which makes it easy to read the code (in reverse) starting from a leaf node.
Internal nodes contain symbol weight, links to two child nodes and the optional link
to a parent node. As a common convention, bit 0 represents following the left child
and bit 1 represents following the right child. A finished tree has up to n leaf nodes
and n-1 internal nodes. A Huffman tree that omits unused symbols produces the most
optimal code lengths.

Huffman encoding is useful as it reduces the average code length used to represent
the symbols of an alphabet.

2.7.5 Huffman Code Complexity

A greedy approach places our n characters in n sub trees and starts by combining the
two least weight nodes into a tree which is assigned the sum of the two leaf node weight
for its root node.The time complexity of Huffman algorithm is O(n log(n))

Algorithmic coandmplexstardthedstsity O(n2) (2.1)

Inserting a new node O(log(n)) (2.2)

n nodes insertions O(nlog(n)) (2.3)

Retrieving two smallest node weights O(log(n)) (2.4)

Given a stored text file that is to be encrypted and compressed, the system first converts
the file into its binary representation. This is then given to the Huffman encoding which
performs compression on the binary data by transforming into a vector.The vector is
next given as input to the encryption process, which then takes in the numeric vector
data and transforms it into a color coded png image.

10
The encrypted image has a series of colored blocks. The process of color assignment
is predefined and is done by grouping 8 bits of the binary data steam together at a time,
thus giving a possibility of all colors .

On the receiving side, the system takes in the encrypted image as input, which it
accesses for restoration. The system checks the color of the various blocks iteratively
and then takes a mean of the values for getting a practical perspective of the color of
the particular block in question. Using this process of decryption, it recreates the vector
data. The vectored data is next given to the Huffman decoder, which converts the data
back to the original binary representation as it was given in the input. The binary file is
translated back to the original ASCII text file, thus restoring the text file and completing
the loss less decompression on the receiver side.

2.8 System Requirements

2.8.1 Hardware Specifications

Hard disk : 20 GB or more


RAM : 2 GB or more
Processor : 1.7 GHz Dual Core

2.8.2 Software Specifications

Languages used: MATLAB


Operating System: Windows 7 and higher versions

2.9 Summary

Thus the above modules describe the analysis of the system with architecture and work-
flow. This ensures that the any image can be sent to any user as it provides security and
confidentiality for user convenience. All modules are explained in detail step by step .

11
CHAPTER 3

MODULE DESCRIPTION

3.1 Introduction

Our complete project deals with the different modules based on the working. The
project consists of various modules as described below:

3.2 List of modules

The list of modules to performed are given below

Input image

Image preprocessing

Encryption

Decryption

Figure 3.1: Workflow


3.3 Description

3.3.1 Image input

The image to be give an as input for the conversion of image using lossless compression
to the color code blocks using Huffman encoding. The image should be in the JPEG
,PNG format as its required condition For converting image to color code blocks.

Figure 3.2: UML diagram of image input

3.3.2 Image preprocessing

The image given is in png or jpeg format as given in the program source code as to be
preprocessed to eliminate disturbance occurred as it also known as median filters to get
accurate or precised output i.e color code blocks. Here the color image get changed to
grey color image

Figure 3.3: UML diagram of image pre-processing

3.3.3 Encryption

Accept the input image and convert to hex-dec text file . Separate the input text into indi-
vidual characters. Input the color-channel (R/G/B) and a color (RGB value).Depending

13
on the predefined block-size (say n), divide the picture box into a grid of blocks, each of
size n.Add the ASCII value of every character with key and put the value in the color-
channel selected. For the remaining 2 channels, put the value of the Color inputted by
the user. Draw the bitmap image.

Figure 3.4: UML diagram for encryption

3.3.4 Decryption

Receiver receives the image. Divide the color image into color blocks according to
block size specified into the key. Get the value of individual color block and subtract the
key from that value. Convert the resulting value into character and get the text. Decrypt
the text using the decryption process of the standard encryption algorithm used. Obtain
the original image back.

Figure 3.5: UML diagram for decryption

3.3.5 Implementation

In encryption,the user selects a one color channel (R, G or B) and gives the values for
remaining two channels between the ranges 0-255. The character is converted to its
ASCII value and assigned to the selected color channel. Also, a block size greater than
0, is specified by the user. Color is given to the color block of the specified block size

14
Figure 3.6: Working concept of color mapping

is then formed by combining the values of all three channels. In Key Generation the
color channel selected and the color block size forms the key. In Image Generation all
the characters are converted to color blocks and then a single image is generated by
combining all the color blocks of plain text.Receiving image and the block size and the
color channel are extracted from the shared secrete key. Extracting of pixel value from
the image-The received image is divided into blocks of the size specified in the key.
A center pixel and its 4-nearest neighbor pixels from each block are extracted and the
most common pixel value is selected. This is to improve the robustness of the algorithm
in the case of presence of noise. Retrieval of the plain text - From the selected pixel
value, the component value of the selected channel is taken (R, G or B component) and
considered as an ASCII value. This ASCII value is then converted to its corresponding
character similarly for all other color blocks. After extracting all such characters, the
original message is retrieved.

3.3.6 Quadtree Decomposition

Quadtree decomposition is an analysis technique that involves subdividing an image


into blocks that are more homogeneous than the image itself. This technique reveals

15
information about the structure of the image. It is also useful as the first step in adaptive
compression algorithms.

The quadtree decomposition using the qtdecomp function. This function works by
dividing a square image into four equal-sized square blocks, and then testing each block
to see if it meets some criterion of homogeneity (e.g., if all the pixels in the block are
within a specific dynamic range). If a block meets the criterion, it is not divided any
further. If it does not meet the criterion, it is subdivided again into four blocks, and
the test criterion is applied to those blocks. This process is repeated iteratively until
each block meets the criterion. The result might have blocks of several different sizes.
Blocks can be as small as 1-by-1, unless you specify otherwise.

qtdecomp returns the quadtree decomposition as a sparse matrix, the same size as I.
The nonzero elements represent the upper left corners of the blocks. The value of each
nonzero element indicates the block size.

Figure 3.7: Block representation of Quadtree decomposition

3.3.7 Conversion of Colors to Binary Form

Every color in RGB model has an equivalent hexadecimal code.Color codes are hex-
adecimal triplets representing the colors red, green and blue (RRGGBB). For example,

16
for red color, code is FF0000, which is 255 red,0 green and 0 blue.

Since each portion of RGB is an 8 bit portion so in 8 bit, the white color is formed
by 255. So in order to make a white color, we set each portion to 255. If we need only
red color, we zero out the rest two portions which are green and blue. The decimal code
is(255, 0, 0). If we need only green color, we zero out the rest two portions which are
red and blue. The decimal code is(0, 255, 0). Similar is the case for blue where the
code will be (0, 0, 255).

Figure 3.8: Colors and its Hexadecimal values

Colors and their hexadecimal values For further proceeding, we need to convert this
hexadecimal code to a binary equivalent form. Now the hexadecimal code of the final
color is considered and this code is converted to the binary form through simple hex to
binary conversion.

3.3.8 Compression of image

Portable network graphics is a raster graphic file format that supports lossless data com-
pression requires that the combination of compression and decompression methods to
be lossless, or else the data cannot be restored in original format. This technique is
done when the image contains a quite a lot of pixels there to reduce the size of the im-
age lossless image compression is done where we use less pits per image .The design
of data compression schemes involves trade-offs among various factors, including the
degree of compression, the amount of distortion introduced (if using a lossy compres-
sion algorithm), and the computational resources required to compress and uncompress
the data.

17
Figure 3.9: Compression of image

3.4 Summary

Thus the above modules describe the working of the application. This ensures that the
any image can be sent to any user as it provides security and confidentiality for user
convenience. All modules are explained in detail . It is expected that the proposed
system can be used worldwide.

18
CHAPTER 4

SYSTEM IMPLEMENTATION

4.1 Introduction

In this chapter implementation of the system is described in detail. Here the detail view
of color code cryptography described.The Platforms like Matlab, java, C#, .net plays a
major role.

4.2 Overview of the Platform

The most popular development platforms are Matlab, java, c, .net. Here look at each of
them:

4.2.1 MATLAB

The MATLAB platform is optimised for solving engineering and scientific problems.
The matrix based MATLAB language is the world most natural way to express compu-
tational mathematics. Built in graphics make it easy to visualise and gain insights from
data. A vast library of pre-built toolboxes lets you get started right away with algorithm
essential to your domain. The desktop environment invites experimentation exploration
and discovery. These MATLAB tools and capabilities are all rigorously tested and de-
signed to work together. The code can be integrated with other languages, enabling you
to deploy algorithms and application within web, enterprise and production systems.

4.2.2 C#.NET

C is an elegant and type-safe object oriented language that enables developer to build va-
riety of secure and robust application that run on the .NET framework. the user can use
C to create windows client application, XML web services ,distributed components,client-
server applications,database application and much more. C# syntax is highly expres-
sive,yet it is also simple and easy to learn .The curly-brace syntax of C# will be instantly
recognizable to anyone familiar with C, C++ or java.

4.2.3 JAVA

Goal of Java is object oriented programming language and portability, which means
that programs written for the Java platform must run similarly on any combination of
hardware and operating system with adequate runtime support. This is achieved by
compiling the Java language code to an intermediate representation called Java byte-
code, instead of directly to architecture-specific machine code. Java bytecode instruc-
tions are analogous to machine code, but they are intended to be executed by a virtual
machine (VM) written specifically for the host hardware. End users commonly use a
Java Runtime Environment (JRE) installed on their own machine for standalone Java
applications, or in a web browser for Java applets. Standard libraries provide a generic
way to access host-specific features such as graphics, threading, and networking. The
use of universal bytecode makes porting simple. However, the overhead of interpreting
bytecode into machine instructions made interpreted programs almost always run more
slowly than native executables. Just-in-time (JIT) compilers that compile bytecodes
to machine code during runtime were introduced from an early stage. Java itself is
platform-independent, and is adapted to the particular platform it is to run on by a Java
virtual machine for it, which translates the Java bytecode into the platforms machine
language.

20
4.3 Implementation Details

4.3.1 Sample Coding

MyMaingui

function varargout = MyMainGUI(varargin) gui_Singleton = 1;


gui_State = struct( gui_Name, mfilename, ...
gui_Singleton, gui_Singleton, ...
gui_OpeningFcn, @MyMainGUI_Openingcn, ...
gui_OutputFcn, @MyMainGUI_OutputFcn, ...
gui_LayoutFcn, [] , ...
gui_Callback, []);

if nargin && ischar(varargin1)


gui_State.gui_Callback = str2func(varargin1);
end
if nargout
varargout1:nargout
= gui_mainfcn(gui_State, varargin:);
else
gui_mainfcn(gui_State, varargin:);
end
function MyMainGUI_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = MyMainGUI_OutputFcn(hObject, eventdata, handles)
varargout1 = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
global file I ir ic d thvec;
thvec=[0.5,0.5,0.5]; [filename,pathname]=uigetfile(*.png,Pick the wav file);
file=strcat([pathname filename]);

21
I=imread(file);
ir ic d
=size(I);
figure, image(I);
title(Original Image);
function pushbutton2_Callback(hObject, eventdata, handles)
global I A B;
A=rgb2gray(I);
figure,imshow(A);
B=medfilt2(A);
figure,imshow(B);
function pushbutton3_Callback(hObject, eventdata, handles)
global thvec ic ic I A img1D fid imgHex binary S valRGB Iback IbackTrim;
imgTrans = A;
img1D = A(:);
imgHex = dec2hex(img1D);
fid = fopen(im16_1.txt, wt);
fprintf(fid, fclose(fid)
binary=dec2bin(imgHex)
S,valRGB
=Huffman_Encode(I,thvec);
Iback=Huffman_Decode(S,valRGB);
IbackTrim=Iback(1:ir,1:ic,:);
function pushbutton4_Callback(hObject, eventdata, handles)
global decimal fid1 img1 IbackTrim binary ;
decimal = bin2dec(binary);
fid1 = fopen(out_1.txt, wt);
fprintf(fid1,

img1 = fscanf(fid1, fclose(fid1)


figure, image(IbackTrim);
title(Output Image);

22
function pushbutton5_Callback(hObject, eventdata, handles)
close all;
clear all;
clc;

4.3.2 Convert Image to Text

function var=converttoclass(var,type)

if (strcmp(type,int8))
var=int8(var);
elseif(strcmp(type,uint8))
var=uint8(var);
elseif(strcmp(type,int16))
var=int16(var);
elseif(strcmp(type,uint16))
var=uint16(var);
elseif(strcmp(type,int32))
var=int32(var);
elseif(strcmp(type,uint32))
var=uint32(var);
elseif(strcmp(type,int64))
var=int64(var);
elseif(strcmp(type,uint64))
var=uint64(var);
elseif(strcmp(type,single))
var=single(var);
elseif(strcmp(type,double))
var=double(var);
else
disp(this type is not allowed or supported);

23
end

4.3.3 Huffman Encoding

function [S,valRGB]=qt3ddecom(I,varargin)

disp();
thvec=[0 0 0];
defaultValues = thvec;
nonemptyIdx = cellfun(isempty,varargin);
defaultValues(nonemptyIdx) = varargin(nonemptyIdx);
thvec
= deal(defaultValues:);
classtr=class(I);
ir ic id
=size(I);
if(id =3)
error(Input Matrix (Image) must be of size M-by-N-by-3 (true color));
end
if( ispowerof2(ir) || ispowerof2(ic))
I=padrgbtomakepowof2(I);
end
irp,icp,id

=size(I);
S=zeros(irp,icp);

count1=1;
stru1(count1).rc=[1 1];
stru1(count1).sz=size(I,1);
while(size(stru1,2)>=1)
r1=stru1(end).rc(1);

24
r2=r1+stru1(end).sz-1;
c1=stru1(end).rc(2);
c2=c1+stru1(end).sz-1;
stru1(end)=[];
count1=count1-1;
b1r,b1c,b2r,b2c,b3r,b3c,b4r,b4c,sz
=qtrgbsplit(I(r1:r2,c1:c2,1:3),thvec);
if(sz==-1)
S(r1,c1)=r2-r1+1;
else b1r=r1+b1r-1;
b1c=c1+b1c-1;
b2r=r1+b2r-1;
b2c=c1+b2c-1;
b3r=r1+b3r-1;
b3c=c1+b3c-1;
b4r=r1+b4r-1;
b4c=c1+b4c-1;
count1=count1+1;
stru1(count1).rc=[b4r,b4c];
stru1(count1).sz=sz;
count1=count1+1;
stru1(count1).rc=[b3r,b3c];
stru1(count1).sz=z3;
count1=count1+1;
stru1(count1).rc=[b2r,b2c];
stru1(count1).sz=sz;
count1=count1+1;
stru1(count1).rc=[b1r,b1c];
stru1(count1).sz=sz;
end
end
S=sparse(S); [i,j,blkSz] = find(S);

25
if(length(find(thvec))==0)
for k=1:length(blkSz)
valRGB(k,1:3)=I(i(k),j(k),1:3);
end
else
valR=avgofmatblks(I(:,:,1),i,j,blkSz,blkSz);
valG=avgofmatblks(I(:,:,2),i,j,blkSz,blkSz);
valB=avgofmatblks(I(:,:,3),i,j,blkSz,blkSz);
valRGB=[valR, valG, valB];
end
if (ir<irp ic<icp)
S,valRGB
=delsparsekeybyxANDy(S,i,j,valRGB,ir,ic);
end
S=trimsparse(S);
valRGB=converttoclass(valRGB,classtr);
drawquadblocks(S);

4.3.4 Huffman Decoding

function I=qtreergbdecode(S,valRGB)

I(:,:,1)=qtreedecode(S,valRGB(:,1));

I(:,:,2)=qtreedecode(S,valRGB(:,2));

I(:,:,3)=qtreedecode(S,valRGB(:,3));

26
4.3.5 Screenshots

The screenshots of the process have been given in a step wise procedure leading to the
output image.

Figure 4.1: Main window

Figure 4.2: Image Input

27
Figure 4.3: Image Preprocessing

Figure 4.4: Encryption

28
Figure 4.5: Decryption

4.4 Summary

In system implementation, all the details regarding the simulation and implementa-
tion of the project have been mentioned along with the sample coding for the color
code cryptography. The screenshot of the every module is also given in the above sec-
tion.Thus,the proposed system has been executed successfully.

29
CHAPTER 5

SYSTEM TESTING

5.1 Introduction

The code review was done with the objective of identifying and correcting deviations
from standards, identifying and fixing logical bugs and fall through and recording code
walkthrough findings after successful completion. The programs were checked and
the code structure was made readable. The variable names are meaningful. It follows
certain naming conventions, which makes the program readable.
1.Variable names are prefixed with their scope and data type.
2.Checking out for the correct scopes for various functions.
3.All possible explanations for the code were given as comments.
4.Sufficient labels and comments are included in the code as the description of it.
5.Code optimization was carried out.

The first level of testing different modules are tested against the specifications pro-
duced during the design of the module. During this testing the number of the arguments
is compared to input parameters, matching of parameter and arguments etc. Unit Test is
conducted using a Test Driver usually.A series of stand-alone tests are conducted dur-
ing Unit Testing. Each test examines an individual component that is new or has been
modified. A unit test is also called a module test because it tests the individual units of
code that comprise the application.Each test validates a single module that, based on the
technical design documents,was built to perform a certain task with the expectation that
it will behave in a specific way or produce specific results. Unit tests focus on function-
ality and reliability, and the entry and exit criteria can be the same for each module or
specific to a particular module. Unit testing is done in a test environment prior to system
integration. If a defect is discovered during a unit test, the severity of the defect will
dictate whether or not it will be fixed before the module is approved. Integration testing
examines all the components and modules that are new, changed ,affected by a change,
or needed to form a complete system. It also differs from system testing in that when
a defect is discovered, not all previously executed tests have to be rerun after the repair
is made. Only those tests with a connection to the defect must be rerun, but retesting
must start at the point of repair if it is before the point of failure. Integration testing
is a systematic testing for constructing the program structure, while at the same time
conducting test to uncover errors associated within the interface. Bottom-up integration
is used for this phase. It begins construction and testing with atomic modules.

5.2 Types of Testing

Testing is the process of executing the program with the intent of finding errors.Testing
cannot show the absence of defects, it can only show that software errors are present.
The testing principles used are:
1. Tests are traceable to user requirements.
2. 80 percent of errors will likely be traceable to 20 percent of program modules.
3. Testing should begin in the small and progress towards testing in the large.

5.2.1 Unit Testing

This is the first level of testing. In this different modules are tested against the speci-
fications produced during the design of the module. During this testing the number of
the arguments is compared to input parameters, matching of parameter and arguments
etc. All five modules are checked separately, each test case is given to each unit and it
is checked. The result is checked to see if the actual outcome is same as the expected
outcome.A unit test is also called a module test because it tests the individual units of
code that comprise the application. Each test validates a single module that was built
toper form a certain task with the expectation that it will behave in a specific way. Dur-
ing this testing the number of the arguments is compared to input parameters, matching
of parameter and arguments etc. All five modules are checked separately, each test case
is given to each unit and it is checked. The result is checked to see if the actual outcome
is same as the expected outcome.A unit test is also called a module test because it tests

31
the individual units of code that comprise the application. Each test validates a single
module that was built to perform a certain task with the expectation that it will behave
in a specific way.

5.2.2 Integration Testing

Integration testing is a process where all the separate modules are combined together
and its working is checked. There are two approaches to this : bottom-up and top-down
integration.At first the branch, semester and grade selection modules are integrated and
checked.Top-down approach is being used in this software testing.

5.2.3 User Acceptance Testing

User acceptance of a system is the factor for the success of any system. The system
under consideration is tested for the user acceptance by constantly keeping in touch
with the prospective system user at the time of developing wherever required.
1. Input screen design.
2. Output screen design.
3. Online message to guide the user.
4. Format of the reports and other outputs.

5.2.4 Test Plan

It is performed during the development of every stage of the application. A plan of


test cases which is prepared to test compliance if the programmer has followed coding
guidelines or not. A plan could be made to test on a regular basis whether there are
any flaws in the system. For our simulation, we use a test bed that is composed of
key elements that facilitate access to the core of the system thus allowing testing at the
deepest level.

32
5.3 Test Cases

5.3.1 Test Objective

There are several rules that can serve as testing objectives. They are:
1. Testing is a process of executing a program with the intent of finding an error.
2. A good test case is one having a high possibility of finding an undiscovered error.
3. A successful test is one that uncovers an undiscovered error. If testing is conducted
successfully according to the objectives stated above, it will uncover errors in the soft-
ware.

5.3.2 Test Result

Table 5.1: Comparison of Expected and Actual Outputs

S.No. Testing Parame- Expected Output Actual Output Result


ter
1. Main window The page displayed should The main page is pass
contains various function to displayed with various
be performed using color functions
code cryptogrphy.
2. Input image The input image in form of The image is uploaded pass
png or jpg should be up- in the required format.
loaded.
3. Image prepro- The uploaded image should The grey scale image is Pass
cessing be preprocessed from color to displayed.
grey scale image to avoid dis-
turbances .

33
Table 5.1: Comparison of Expected and Actual Outputs

S.No. Testing Parame- Expected Output Actual Output Result


ter
4. Encryption The grey scale image should The color code image is Pass
be converted into hex-dec text displayed.
and later it should be con-
verted into binary code with
the help of Huffman encoding
and later converted into color
codes
5. Decryption The obtained color code im- The original image is Pass
age should be decrypted to displayed.
get back the original image.

5.3.3 Performance Testing

This provides the final assurance that the software meets all functional, behavioural and
performance requirements. Validation succeeds when the software functions in the way
the user expects. Once this is done, the system is free of errors and the website is created
and designed successfully.

5.4 Summary

During these tests, the number of arguments are compared to input parameters, match-
ing of parameters and arguments etc. It improves the performance overload and the
computation of test has been executed .

34
CHAPTER 6

CONCLUSION

The project named Image text color code cryptography has been designed with the ba-
sic functions of MATLAB code.System has satisfied all the proposed work.This project
converts the image text to color code cryptography successfully. Todays standard cryp-
tographic methods are subjected to various attacks. Thus an innovative approach is
presented in this project and it makes the information more secured by color coding.
CHAPTER 7

FUTURE ENHANCEMENT

The project named "Image text color code cryptography" has been designed with the ba-
sic functions of MATLAB code.System has satisfied all the proposed work.This project
converts the image text to color code cryptography successfully. Todays standard cryp-
tographic methods are subjected to various attacks .Thus an innovative approach is pre-
sented in this project and it makes the information more secured by color coding. This
can be further extended for video and other higher levels of data.
CHAPTER 8

REFERENCES

[1] G. O. Young, "Synthetic structure of industrial plastics (Book style with paper title
and editor)," in Plastics, 2nd ed. vol. 3, J. Peters, Ed. New York: McGraw-Hill, 1964,
pp. 15-64.

[2] Data Encoding and Compression using ASCII, VEDA Institute, Hyderabad
(published in July 2009)-ACM Journal

[3] Data Encryption Standards - Roy F. Van Buren, CPA CISA (c) 1990-ACM Jour-
nal

[4] Data Compression via Textual Substitution - JAMES A. STORER AND THOMAS
G. SZYMANSKI, Princeton University, Princeton, New Jersey-ACM Journal

[5] Data Compression - DEBRA A. LELEWER and DANIEL S. HIR-SCHBERG


Department of Information and Computer Science, University of California, Irvine,
California 92717-ACM Journal

[6] Lossless Data compression techniques - Klaus Holtz, Eric Holtz, Omni Dimen-
sional Networks , San Francisco , CA 94109-IEEE Research Paper

[7] RGB Coloured Image Encryption Processes Using Several Coloured Keys Im-
ages - By Rami El Sawda (IEEE senior member) HabibHamam (IEEE senior Member)-
IEEE Research Paper

[8] "Data Can Now Be Stored on Paper" (http:/ / www. arabnews. com/?page=4
section=0 article=88962 d=18 m=11 y=2006) by M. A. Siraj, Arab News (published
November 18, 2006)

[9] "Store 256GB on an A4 sheet" (http:/ / www. techworld. com/ sto-rage/news/


index. cfm?newsID=7424) by Chris Mellor, Techworld (published November 24, 2006;
accessed November 29, 2006)

[10] Rainbow Storage, SainulAbideen, Kerala. (Published in November 2006)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy