133
Page | 2 1.1 Motivation & Need: Our daily lives are often very dependent on secure communication of information. A thing likes credit card payments at banks, online shopping at book shop, and mobile phone calls to our friends or transferring the information through internet all require a way to keep the information confidential and correct. So to get a general idea of what cryptography is, it is good to put it into context of general secure transmission of information. Basically Cryptography [20] provides a way where any entity can communicate securely in adversarial environments. Cryptographic technique are symmetric, if both the sender and the receiver of a information are using the same private key, as in the case of block and stream ciphers and message authentication codes. There are another type of symmetric technique [15] are cryptographic hash functions, where neither sender nor receiver need to know a private key at all. In contrast to this, cryptographic technique is asymmetric, if sender and receiver are using different keys, typically a ―public‖ and a ―private‖ one. Symmetric cryptography technique are very efficient in practically than asymmetric cryptography technique, most security [30] applications use symmetric cryptography to ensure the privacy, the authenticity and the integrity of sensitive data. Even most applications of public- key cryptography are actually working in a hybrid way by transmitting a cipher key with asymmetric techniques while symmetrically encrypting the payload data under the cipher key. The work here will concentrate on the symmetric cryptography technique with the aim of providing a brief account of the history of cryptography, a more detailed overview of the different modern methods [8] available, a quick look at the future directions, and a couple of case studies to provide some examples about the applications of cryptography. 1.2 Loadstars: The loadstar i.e. the objectives of the proposed research is to introduce a new cryptography algorithm [21] for text, image, mp3, pdf, xls and other type of information file format so as to test and evaluate it with the existing ones. This thesis is computing and comparing encryption time, CPU utilization and memory utilization of different text file with and without the proposed algorithm. It‘s also comparing the security levels of the encrypted data generated by the proposed technique and the other existing technique while trying to improve the efficiency & lower the power consumption [13] for the complete process. Finally main concentration of the thesis is to introduce a cryptography method to exchange the secret information between the sender and the receiver.

New Symmetric Encryption Algorithm Using Block Cipher Substitution Technique

Embed Size (px)

DESCRIPTION

New Symmetric Encryption Algorithm Using Block Cipher Substitution Techniquem.tech thesis iit Delhi dissertation cse computer science engineering

Citation preview

Page | 2

1.1 Motivation & Need: Our daily lives are often very dependent on secure

communication of information. A thing likes credit card payments at banks, online shopping at

book shop, and mobile phone calls to our friends or transferring the information through internet

all require a way to keep the information confidential and correct. So to get a general idea of

what cryptography is, it is good to put it into context of general secure transmission of

information.

Basically Cryptography [20] provides a way where any entity can communicate securely in

adversarial environments. Cryptographic technique are symmetric, if both the sender and the

receiver of a information are using the same private key, as in the case of block and stream

ciphers and message authentication codes. There are another type of symmetric technique [15]

are cryptographic hash functions, where neither sender nor receiver need to know a private key

at all. In contrast to this, cryptographic technique is asymmetric, if sender and receiver are using

different keys, typically a ―public‖ and a ―private‖ one.

Symmetric cryptography technique are very efficient in practically than asymmetric

cryptography technique, most security [30] applications use symmetric cryptography to ensure

the privacy, the authenticity and the integrity of sensitive data. Even most applications of public-

key cryptography are actually working in a hybrid way by transmitting a cipher key with

asymmetric techniques while symmetrically encrypting the payload data under the cipher key.

The work here will concentrate on the symmetric cryptography technique with the aim of

providing a brief account of the history of cryptography, a more detailed overview of the

different modern methods [8] available, a quick look at the future directions, and a couple of

case studies to provide some examples about the applications of cryptography.

1.2 Loadstars: The loadstar i.e. the objectives of the proposed research is to introduce a new

cryptography algorithm [21] for text, image, mp3, pdf, xls and other type of information file

format so as to test and evaluate it with the existing ones. This thesis is computing and

comparing encryption time, CPU utilization and memory utilization of different text file with

and without the proposed algorithm. It‘s also comparing the security levels of the encrypted data

generated by the proposed technique and the other existing technique while trying to improve

the efficiency & lower the power consumption [13] for the complete process. Finally main

concentration of the thesis is to introduce a cryptography method to exchange the secret

information between the sender and the receiver.

Page | 3

1.3 Commence: Security is the important factor in the public network and cryptography [22]

play an important role in this field. Cryptography [23] is very old and secured technique of

information in public network. Presented work is to develop and implement new symmetric key

algorithms for bulk data encryption. This thesis has design a block cipher [10] symmetric key

algorithm [36] on fixed-length groups of bits, called blocks. This thesis proposed a new

symmetric cipher algorithm [41] using standard constructs (e.g. festal cipher, substitution

permutation network etc). Titled of the thesis ―Design & Implementation of New Symmetric

Encryption Algorithm using Block Cipher substitution Technique‖ involves the study of

concepts of cryptography, design constructs (and techniques) and symmetric block cipher

algorithms. Propose concept of new block cipher symmetric algorithm is that a plaintext will

divided into fixed length data blocks and each block will equip with a unique key. The unique

keys will be generated by the predefine process and this unique key will be the same length as

the data block. In this each data block will be process using propose algorithm. The performance

and strength of new algorithm will expect to be better than conventional cryptographic algorithm

and highly effective against brute force attack. A windows application has implemented in order

to illustrate and test the performance and robustness of the new encryption algorithm.

A message can be plaintext or in other form like image, audio, video etc. The process of

unreadable a message in such a way as to hide its meaning is encryption. An encrypted message

is cipher text. The process of reversing cipher text back into plaintext is decryption. A key is a

well define process that determines the functional output of a cryptographic algorithm or cipher.

In encryption, a key specifies the particular transformation of plaintext into cipher text, or vice

versa during decryption. The range of possible values of the key is called the key space. A

cryptosystem is an algorithm, plus all possible plaintexts, cipher texts, and keys. Encryption and

decryption functions are represented as:

EKey (Msg) = Cip

DKey (Cip) = Msg

These functions have the property that:

DKey (EKey (Msg)) = Msg

The art and science of keeping messages secure is cryptography, and it is practiced by

cryptographers. Cryptanalysis is the art and science of recovering the plaintext of a message (or

breaking the cipher text) without access to the key. Successful cryptanalysis may recover the

plaintext or the key. Cryptanalysts are practitioners of cryptanalysis; that is, seeing through the

disguise. The branch of mathematics encompassing both cryptography [24] and cryptanalysis is

cryptology and its practitioners are cryptologists. In contrast, a code is a method used to

Page | 4

transform a message into an obscured form, preventing those who do not possess special

information, or key, required to apply the transform from understanding what is actually

transmitted. The usual method is to use a codebook with a list of common phrases or words

matched with a codeword. Encoded messages are sometimes termed code text, while the original

message is referred to as plaintext [19].

1.4 Why use encryption: Every body these days most often wants to keep secrets.

Everyone has a need to keep some things secret. The operating system has secrets it needs to

keep away from users, users want their credit card details kept secret and away from hackers,

everyone wants their financial and health affairs secret, and, sadly, it appears that even today

people still need to keep their religious persuasions secret. It is unfortunate, but the need to keep

a wide variety of information secret also means that people can also use encryption to keep

secret things that society has decided are unlawful, such as the plans to rob a bank. Encryption

technologies also have other valuable capabilities. Any attempt to falsify the content of an

encrypted message will cause failure during decryption. This was not the case with the Caesar

cipher, where each letter was transformed separately from every other letter, so altering one or

more letters might well not be noticed by the recipient. But modern mathematical systems are

such that it is highly unlikely that anyone could change even one element (usually called a bit or

binary digit) in an encrypted file without causing everything from that point onwards to be

turned into gibberish. Further, encryption can be used to detect if information has been changed

or corrupted, whether it is actually encrypted or not. And this can be very valuable if you cannot

encrypt the information itself but need to be able to show that it is correct. This technique is

commonly used to verify computer applications software that has been downloaded from the

web. So encryption is used for keeping secrets, preventing information falsification and

verifying that the information received is the information that was sent.

1.5 Where is encryption commonly used: The commonest use of encryption probably

occurs in Internet transactions using a technology called Secure Sockets Layer (SSL). It is in

use whenever see a little padlock appear in the bottom right hand corner of Internet browser.

What SSL means is that information passing between two points in a network is encrypted so

that nobody else can read it or readily change it. Unfortunately the way SSL is usually

implemented has created a few problems: neither point on the network knows exactly who the

other point is there is no proof at all as to where the information actually came from the

information is immediately decrypted on arrival, so it cannot possibly rely on SSL alone to keep

Page | 5

the information secret because that is something it was never designed to do. The second and

third commonest uses are secure email/messaging and digital rights management (DRM). The

massive numbers of financial transactions passing over public and private networks are all

protected using encryption. So is much healthcare information, all credit card information, and

increasingly, aerospace and administration (government). Add to that the increasing number of

occasions when encrypted information is attached to emails covering everything from

communications between corporate management and their lawyers to information for the R&D

department and it has a really huge amount of encrypted information. DRM, digital rights

management systems, can only be implemented if information is encrypted. And the reason is

very simple. No encryption and there is no way of applying management. DRM controls only

get implemented where encryption is used to ensure that only the authorized can get in, and their

rights are limited by the interpretation of the license by the application carrying out the

decryption. Web-commerce is also growing into one of the fastest-growing sector of industry in

the past two years. Billions of dollars have passed hands in the process and each entrepreneur

wants a slice of the dough. To make this possible, data encryption plays a very central role in

ensuring customers that paying for anything online is secure. One question has come in mind

that why e-commerce need encryption. In order to enable secure online transaction, data

encryption plays four important functions [19]:

Digital authentication allows both the customers and the merchant to be sure that they

are dealing with whom the other party claims to be. This is absolutely necessary before

sending credit card details to the merchant and also allows merchants to verify that the

customer is the real owner of the credit card being used.

Integrity ensures that the messages received re not changed during transmission by any

third party.

Non-repudiation prevents customers or merchants denying they ever received or sent a

particular message or order.

In the event that information is intercepted, encryption ensures privacy that prevents

third parties from reading and or using the information to their own advantage

There are two methods of encryption can be used in e-commerce one is private-key encryption

(secret-key or symmetric encryption) in which users share a common key. And second is public-

key encryption (also known as asymmetric encryption) where different keys are used for

encryption and decryption. These systems have their advantages and disadvantages and so

Page | 6

secure transaction protocols such as Netscape's Secure Sockets Layer and Secure Electronic

Transaction use a combination of both [10].

1.6 Is encryption a perfect solution: Like any technology, it is all down to

implementation? Often people tell us its all down to key length. But it also has to know the

algorithm that is being used. If implemented the Caesar cipher that mentioned earlier on, they

can claim any key length they like, but the algorithm works by switching so many letters along

the alphabet from the letter selected to the one that is used in the cipher. So regardless of what

they think, the maximum effective key length is 25, and breaking it does not require the brain of

a planet. It is need to know what algorithm and key length have actually been used. It would

help if knew that the implementation is actually good and effective. Unfortunately, at the

moment don't have any external test systems that will tell us if the supplier has actually

implemented the algorithm they claim with the key they claim because it is very difficult to

inspect an encrypted file and say if the implementation is any good or not. Avoid any algorithm

using a key length of less than 64 bits, and be aware that 64 bit keys are likely to have a limited

life because the power of desktop computers is increasing so rapidly that a technique called

brute force attack where simply try every possible key until find the one that works is now

entirely feasible. In any event, a 128 bit key is the minimum that should be considering. Here,

standards and other opinions can help us make an informed decision.

1.7 Benefits of Data Encryption: Securing the data is necessary for commercial

organizations. If company loses all important information for no matter what the reason is (a

physical theft or a natural disaster), the consequences may be unpredictable and even ruin the

whole business. Among numerous security [42] mechanisms the most effective for protecting

any confidential information is data encryption. Every company has its own invaluable

information that must be secured and protected to ensure the confidentiality and integrity of the

organization. It may be information on employees and clients, product database or business

outline - everything, that is so important for business that won't be able to operate if it will be

gone. And if any online criminal will get an access to this data, the damage may be irreparable.

It is important understand that any data is vulnerable and may be compromised in two ways:

Physical attack - For example, a disgruntled or recently fired employee wants to damage the

organization and decided to steal or destroy data. Virtual attack - It may be a dishonest industry

rival that learned to bypass security and gain access to competitors' data, or a malicious attack,

which is intended to purposely corrupt data. Most of the organizations use multiple hardware

Page | 7

solutions like routers and firewalls to ensure the security of confidential data. Such devices can

protect data because they keep any external threat out of the network. But intruders developed

numerous ways to attack organizations' networks and obtain necessary information. In case one

of them will work and company's first line of defense will be penetrated, data encryption will

ensure secret data won't be viewed. Decades ago encryption was used only in military solutions,

but now it's a widespread method of securing data. No matter if it is a software or hardware-

based method, it is still fast, reliable and easy to use. What are the key benefits such a solution

may offer [11, 13]

Power: data encryption relies on global standards that can guarantee potential corruption

will be mitigated without flaw. There are many solutions that are so large they ensure an

entire organization is fully compliant with security policies. Data encryption solutions

are affordable enough and may provide even a military-level security for any

organization. Transparency: if a security measure negatively affects business, employing

it will be a bad idea. Efficient encryption solutions allow normal business flow while

crucial data is being silently secured in the background. Sometimes it is the best solution

when there is no need for user to be aware of what is going on.

Flexibility: Data encryption will help to save and protect any important data, whether it

is stored on a laptop or desktop computer, removable storage media, a PDA, an email

server or corporate network. Moreover, it will make it possible to securely access files

from any place - at the office, at home or on the road. In case if the storage device is

stolen or lost, the data will anyway be impossible to read as it is encoded by the

mechanism of the data encryption. Data encryption has many advantages as it allows

solidly protecting and securing data. It offers peace of mind and saves resources that can

be used for perimeter defenses. It is no matter how many security measures you've

applied to protect network, they all are inefficient until important data will not be

protected itself.

1.8 Characteristic of Security: The main characteristic of security is to ensure

information security which is protecting information and information systems from unauthorized

access, use, modification, inspection, or destruction. Security includes important techniques such

as cryptography [25] in this encryption/decryption, hashing, digital signatures, timestamps etc

Page | 8

various technique to ensure information security. Broadly speaking, cryptography [26] performs

following 4 key characteristic [10]:

Confidentiality: Protection against the disclosure of information to parties other than the

intended recipient (for example: encryption and decryption).

Authentication: It should be possible for the receiver of a message to ascertain its

origin; an intruder should not be able to masquerade as someone else (for e.g. public key

cryptography and digital signatures).

Integrity: It should be possible for the receiver of a message to verify that it has not been

modified in transit; an intruder should not be able to substitute a false message for a

legitimate one (for e.g. hashing).

Non-repudiation: A sender should not be able to falsely deny later that he sent a

message (for e.g. digital signatures with timestamps).

1.9 Summary: In this chapter covered areas are motivation & need that covers the need of

any existing work & the requirement of new work to be introduced in the field of cryptography

& particularly in encryption. Loadstars that is the objective with the brief that how to start

concept & discussing about the introduction. This chapter also covers why use encryption is

encryption a perfect solution benefits of data encryption & characteristic of Security.

Page | 9

Chapter 2

Cryptography

Page | 10

2.1 Briefings: Many times when data is exchanged electronically the privacy of the data is a

requirement. The use of encryption restricts unintended recipients from viewing the data, which

are deemed confidential and potentially dangerous if made known to irresponsible parties.

Today, encryption is the procedure of transforming plaintext, data that can be read by anyone, to

cipher text, data that can only be read by someone with a secret decryption key. A message

before being changed in any way is called plaintext. Plaintext messages are converted to cipher

text via some encryption method. A particular such method is called a cryptosystem.

The typical selling technique of an encryption system vendor or developer is to distract the

buyer with discussion of the various encryption algorithms and downplay the importance of

cryptosystem implementation and protocols. In reality, the importance of evaluation of the two

areas is reversed. Good encryption algorithms are relatively a dime a dozen. There are many

proven, available algorithms available out there. A vendor would be irresponsible to not choose

algorithms and techniques with a proven track record. The difficult design decision is how to

implement these disparate tools. The difficult design decisions are encountered when cobbling

together a cryptosystem or protocol from these tools and materials. Also, there are many security

implications when making the transition from theory to practice.

Cryptography: - Cryptography [27] is the practice and study of hiding information. In today‘s

environment, cryptography [28] is considered a branch of both mathematics and computer

science, and is affiliated closely with information theory, computer security, and engineering.

Cryptography [29] is used in technologically advanced applications, including areas such as the

security of ATM cards, computer passwords, and electronic commerce, which all depend on

cryptography. Cryptography has long been of interest to intelligence gathering and law

enforcement agencies. There has historically been a history of controversial legal issues

surrounding cryptography [19]. In some countries the use of cryptography is restricted. Until

1999, France significantly restricted the use of cryptography domestically. In China, a license is

required to use cryptography. Many countries have tight restrictions on the use of cryptography.

In the United States, cryptography is legal for domestic use, but there has been much conflict

over legal issues related to cryptography, export controls and civil liberties [19].With the advent

of modern computer technology, many of these older ciphers became trivially crack-able using

brute-force attacks. Modern cryptography, essential to the security of computer networks, is

done with complex algorithms implemented on high speed computer systems. Generally

speaking, computer cryptographic tasks can be broken into two general categories: encryption

and authentication.

Page | 11

Encryption: Encryption refers to the scrambling of information so that the original

message cannot be determined by unauthorized recipients. An encryption algorithm is

applied to the message, referred to as the plaintext, and a key to produce cipher text,

which ideally appears to be random bits. A decryption algorithm converts the cipher text

back into plaintext, but only if given the correct key. Conventional, or symmetric,

algorithms use the same key for both encryption and decryption. Public key algorithms

use paired keys, one for encryption and another for decryption.

Authentication: Authentication is the verification of a message's sender. Authentication

requires protecting a message so it cannot be altered, usually by attaching to it a digital

signature. Typically, the signature is formed by computing a hash of the message, which

is encrypted using a public key cryptosystem, insuring that nobody without the proper

key can generate a valid signature. Note that authentication is different from encryption,

since the actual message may be completely unencrypted, and cryptography used only to

validate the identity of the creator.

2.2 Type of Cryptography: Basically there are three type of cryptography

Classical cryptography

Rotor Machine

Modern Cryptography

Fig 2.1: Classical cryptography classification

Page | 12

2.2.1 Classical Cryptography [33]: There are generally two broad classifications of classical

cryptographic methods [8]:

Masking: The use of masking leads to ―substitution‖. Often message is masked in such a

way that the resulting message that goes out in an open communication channel, seems

harmless and inconspicuous.

Veiling: The use of veiling leads to ―transposition‖, as veiled messages are usually not

masked at all, but simply combined within other items regularly in such a way that

resulting message takes form of yet another message, called acrostics.

The oldest, simplest and the most primitive of all of the methods [38], the 'translation table',

have been used long since, before the first computer was invented. Each chunk of data (usually 1

byte) is used as an offset within a translation table, and the resulting translated value from within

the table is then written into the output stream. The encryption and decryption programs would

each use a table that translates to and from the encrypted data. While this method is very simple

and fast, the down side is that once the translation table is known, the code is broken. Further,

such a method is relatively straightforward for code breakers to decipher. Still, for general

unread-ability of encoded data, without adverse effects on performance, the translation table

method lends itself well.

2.2.2 Rotor Machine: In classical cryptography, one of the earliest encryption methods was the

simple substitution cipher, where letters in a message were systematically replaced using some

secret scheme. Mono alphabetic substitution ciphers used only a single replacement scheme —

sometimes termed an "alphabet"; this could be easily broken, for example, by using frequency

analysis. Somewhat more secure were schemes involving multiple alphabets, poly alphabetic

ciphers. Because such schemes were implemented by hand, only a handful of different alphabets

could be used; anything more complex would be impractical. However, using only a few

alphabets left the ciphers vulnerable to attack. The invention of rotor machines mechanized poly

alphabetic encryption, providing a practical way to use a much larger number of alphabets. The

most widely known rotor cipher device is the German Enigma machine used during World War

II, of which there were a number of variants. The standard Enigma model, Enigma I, used three

rotors. At the end of the stack of rotors was an additional, non-rotating disk, the "reflector,"

wired such that the input was connected electrically back out to another contact on the same side

and thus was "reflected" back through the three-rotor stack to produce the cipher text.

Page | 13

Fig 2.2: A German standard Enigma Machine

2.2.3 Modern Cryptography technique: Keys are the fundamental essential element in

generating modern cipher text. A string of bits used widely in cryptography, allowing people to

encrypt and decrypt data; a key can be used to perform other mathematical operations as well.

Given a cipher, a key determines the mapping of the plain text to the cipher text. The key to a

particular cryptosystem is some value which, when applied to cipher text, allows the encrypted

message to be decrypted and when applied to plaintext encrypts it. It is important to note that in

the study of cryptography [34] one talks about the lengths of keys in terms of bits. Messages,

too, can be encrypted in n-bit blocks. The longer a key is the more difficult it is to break the

encrypted message.

The most common method of breaking ciphers is by a brute-force attack. This sort of attack

involves running through possible combinations of keys and applying them to the cryptosystem

until the message is decrypted. It is the same as trying to guess a PIN for someone's ATM card

by going through all the possible combinations of numbers. It is said that any University

computer science major would have enough computer power available to be able to break most

56-bit key cryptosystems in less than one week [8].

One very important feature of a good encryption scheme is the ability to specify a key or

password of some kind, and have the encryption method alter itself such that each key or

password produces a different encrypted output, which requires a unique key or password to

decrypt. This can either be a symmetrical key (both encrypt and decrypt use the same key) or

asymmetrical (encrypt and decrypt keys are different). The popular PGP public key encryption,

Page | 14

and the RSA encryption that it's based on, uses an asymmetrical key. The encryption key, the

public key, is significantly different from the decryption key, the private key, such that

attempting to derive the private key from the public key involves many hours of computing

time, making it impractical at best.

There are two type of cryptography technique is available which is following

Symmetric Cryptography Technique (Private Key Cryptography)

Asymmetric Cryptography Technique (Public Key Cryptography)

2.2.3.1 Symmetric Cryptography [16]: Fig. 2.3 shows the traditional encryption techniques

which rely on both the sender and the receiver of a message knowing a particular secret key. The

sender encrypts the message with a particular cryptosystem using the secret key and the receiver

decrypts the message with the same key. This method of encryption is called private key, or

symmetric, encryption. It relies on no one else being able to find out what the private key is.

This is fine if encrypted files are only stored on the hard disk (in which case only the encrypt or

needs to know the key) or if one is sending data to someone close by, say in the same office, in

which case one can let the key be known personally. If the receiver is not close by, however,

then the key must somehow be sent. It could be sent by courier or told over the telephone or

even sent separately to the actual message. All these methods involve trusting a third party not to

divulge the secret key. Furthermore, the receiver of the message must also be trusted, as they

could decrypt any message sent using the same key [19].

Fig 2.3: Encryption Technique

Page | 15

Disadvantages Include:

1. For use in anything other than private encryption of files, one could not determine the

authenticity of the originator of the data. This lack of protection does not allow this method to

verify electronic orders and financial transactions.

2. The private key used now has to be transmitted in a very secure channel. Spontaneous

secure transmission may not be feasible.

3. When used across a network of users, there may have to be a large number of keys to

facilitate one-to-one communication between each user. This adds up to (n

2) = n ( n - 1 ) / 2.

In general, symmetric key algorithms use a single, shared secret key. The same key is used for both

encrypting and decrypting the data. There are two primary types of symmetric algorithms:

Block Cipher

Stream Cipher

Block Cipher: In Fig. 2.4 a block cipher is used to encrypt a text to produce a cipher text, which

transforms a fixed length of block data size into same length block of cipher text in which a secret

key and algorithm are applied to the block of data. For example, a block cipher might take a 128-bit

block of plaintext as input, and output a corresponding 128-bit block of cipher text. This process

should be conducted by a user providing a secret key and the decryption process is the inverse

transformation to the cipher text using the same key. Algorithm based on block cipher technique is

Blow-Fish, DES, AES, IDEA, RC6 and many more.

Fig 2.4: Block Cipher

Page | 16

Stream Cipher: In fig. 2.5 a stream cipher is shown it is a symmetric key cipher where plaintext

bits are combined with a pseudorandom cipher bit stream (key stream), typically by an

exclusive-or XOR operation. In a stream cipher the plaintext digits are encrypted one at a time,

and the transformation of successive digits varies during the encryption. An alternative name is a

state cipher, as the encryption of each digit is dependent on the current state. In practice, the

digits are typically single bits or bytes. Algorithm Based on stream cipher is RC4, CAST and

many more.

Fig 2.5: A stream cipher

Symmetric Encryption (Strengths & Weaknesses): Symmetric encryption algorithms are

typically simpler than asymmetric encryption algorithms. This means that they are fast, easy to

implement and less reliant on computer resources, such as processor power and memory, but

also easier to understand and break into, or crack. The principal weakness of symmetric

encryption is that if an attacker compromises the encryption key, he can read all the messages

encrypted with that key. This means that if hundreds of keys are distributed to users, they all

need to be redistributed to maintain security if the key is compromised.

2.2.3.2 Asymmetric Cryptography: In general asymmetric key algorithm is use two different

key for encryption and decryption known as private and public where public key is used for

encryption and private key is used for decryption as shown in Fig 2.6. RSA is the example of

asymmetric key cryptography technique.

Page | 17

The need for alternative to private key encryption

Early Development of Alternative Key Exchange Mechanism

Development of Asymmetrical Key Encryption

Fig 2.6: A Public Key Encryption

The need for alternative to private key encryption: Public key encryption was invented in

1976 to circumvent the problems of managing the private key. The whole point of encryption is

to keep messages private. At that point, all you could do was encrypt the message with a key,

and get both the encrypted message and the key to the target person. The US government found

a rather expensive solution to this problem. Keys were sent via couriers, in briefcases

handcuffed to their arms. If a courier did not arrive, then all messages on that key would be

destroyed, and another courier would be sent again. Public key encryption is also known as

asymmetric key encryption. It uses different keys to encrypt and decrypt a message. Under this

system everyone gets a pair of keys: a public key which is published for all to see and use, and a

private key which is to be kept secret. The public key could then be used to encrypt a message,

which only the holder of the private key, could decrypt and read. The private key never gets

transmitted, so there are no problems associated with symmetric key encryption. Furthermore,

public key encryption can be used for authentication via the digital signature mechanism. In this

Page | 18

sense, asymmetric key is particularly strong in authentication. Message is not only protected in

terms of secrecy, but also in integrity. Public key, or asymmetric key encryption, ciphers

generally require longer keys than symmetric ciphers to achieve the same level of security.

Comparing key lengths between different encryption algorithms is not particularly productive as

the different algorithms have different characteristics. Even though asymmetric methods require

much longer time to decrypt than symmetric method by several powers of ten, it is justified and

can be afforded, as both signatures and keys are usually short compared to the message itself.

Asymmetric Encryption (Strengths & Weaknesses): In asymmetric encryption, the only key

that is ever distributed to recipients is the public key. The private key is never distributed, so it

cannot be intercepted or compromised. Even if the private key is compromised by some means,

only one pair of keys needs to be redistributed to maintain security. Asymmetric encryption is

therefore inherently more secure than symmetric encryption, especially for large businesses

conducting e-commerce transactions. The complexity of asymmetric encryption algorithms

does, however, mean that they are slower and require more computer resources than symmetric

encryption algorithms, which is reflected by increased hardware costs.

2.2.3.3 Symmetric vs. Asymmetric Encryption: Public key cryptography has the major

advantage that sender does not need to exchange any secret information with receiver before

they can start encrypting, schemes which do rely on the secrecy of their encryption function still

play a vital role in practical systems. The reason is that implementations of secret key or

symmetric encryption algorithms, as they are called nowadays, are orders of magnitude more

efficient than their public key (or asymmetric) counterparts. As its title suggests, this thesis will

exclusively deal with symmetric encryption algorithms.

2.3 Cryptanalysis and Attacks: Cryptanalysis is the art of deciphering encrypted

communications without knowing the proper keys. There are many cryptanalytic techniques.

Some of the more important ones for a system implementer are described below [18, 22].

Cipher text-only attack: This is the situation where the attacker does not know anything

about the contents of the message, and must work from cipher text only. In practice it is

quite often possible to make guesses about the plaintext, as many types of messages have

fixed format headers. Even ordinary letters and documents begin in a very predictable

way. For example, many classical attacks use frequency analysis of the cipher text,

Page | 19

however, this does not work well against modern ciphers.

Modern cryptosystems are not weak against cipher text-only attacks, although sometimes

they are considered with the added assumption that the message contains some statistical

bias.

Known-plaintext attack: The attacker knows or can guess the plaintext for some parts

of the cipher text. The task is to decrypt the rest of the cipher text blocks using this

information. This may be done by determining the key used to encrypt the data, or via

some shortcut. One of the best known modern known-plaintext attacks is linear

cryptanalysis against block ciphers.

Chosen-plaintext attack: The attacker is able to have any text he likes encrypted with

the unknown key. The task is to determine the key used for encryption.

A good example of this attack is the differential cryptanalysis which can be applied

against block ciphers (and in some cases also against hash functions).

Some cryptosystems, particularly RSA, are vulnerable to chosen-plaintext attacks. When

such algorithms are used, care must be taken to design the application (or protocol) so

that an attacker can never have chosen plaintext encrypted.

Man-in-the-middle attack: This attack is relevant for cryptographic communication and

key exchange protocols. The idea is that when two parties, A and B, are exchanging keys

for secure communication (e.g., using Diffie-Hellman), an adversary positions himself

between A and B on the communication line. The adversary then intercepts the signals

that A and B send to each other, and performs a key exchange with A and B separately.

A and B will end up using a different key, each of which is known to the adversary. The

adversary can then decrypt any communication from A with the key he shares with A,

and then resends the communication to B by encrypting it again with the key he shares

with B. Both A and B will think that they are communicating securely, but in fact the

adversary is hearing everything.

2.4 Standard of Cryptographic Algorithms: Good cryptographic systems should

always be designed so that they are as difficult to break as possible. It is possible to build

systems that cannot be broken in practice (though this cannot usually be proved). This does not

significantly increase system implementation effort; however, some care and expertise is

required. There is no excuse for a system designer to leave the system breakable. Any

mechanisms that can be used to circumvent security must be made explicit, documented, and

brought into the attention of the end users. In theory, any cryptographic method with a key can

Page | 20

be broken by trying all possible keys in sequence. If using brute force to try all keys is the only

option, the required computing power increases exponentially with the length of the key. A 32

bit key takes 232

(about 109) steps. This is something anyone can do on his/her home computer.

A system with 40 bit keys takes 240

steps - this kind of computation requires something like a

week (depending on the efficiency of the algorithm) on a modern home computer. A system

with 56 bit keys (such as DES) takes a substantial effort (with a large number of home

computers using distributed effort, it has been shown to take just a few months), but is easily

breakable with special hardware. The cost of the special hardware is substantial but easily within

reach of organized criminals, major companies, and governments. Keys with 64 bits are

probably breakable now by major governments, and within reach of organized criminals, major

companies, and lesser governments in few years. Keys with 80 bits appear good for a few years,

and keys with 128 bits will probably remain unbreakable by brute force for the foreseeable

future. Even larger keys are sometimes used. However, key length is not the only relevant issue.

Many ciphers can be broken without trying all possible keys. In general, it is very difficult to

design ciphers that could not be broken more effectively using other methods. Designing your

own ciphers may be fun, but it is not recommended for real applications unless you are a true

expert and know exactly what you are doing [22]. One should generally be very worried of

unpublished or secret algorithms. Quite often the designer is then not sure of the security of the

algorithm, or its security depends on the secrecy of the algorithm. Generally, no algorithm that

depends on the secrecy of the algorithm is secure. Particularly in software, anyone can hire

someone to disassemble and reverse-engineer the algorithm. Experience has shown that the vast

majority of secret algorithms that have become public knowledge later have been pitifully weak

in reality [19].

The key lengths used in public-key cryptography are usually much longer than those used in

symmetric ciphers. This is caused by the extra structure that is available to the cryptanalyst.

There the problem is not that of guessing the right key, but deriving the matching secret key

from the public key. In the case of RSA, this could be done by factoring a large integer that has

two large prime factors. In the case of some other cryptosystems it is equivalent to computing

the discrete logarithm modulo a large integer (which is believed to be roughly comparable to

factoring when the module is a large prime number). There are public key cryptosystems based

on yet other problems. To give some idea of the complexity for the RSA cryptosystem, a 256 bit

modulus is easily factored at home, and 512 bit keys can be broken by university research

groups within a few months. Keys with 768 bits are probably not secure in the long term. Keys

with 1024 bits and more should be safe for now unless major cryptographically advances are

Page | 21

made against RSA; keys of 2048 bits are considered by many to be secure for decades. It should

be emphasized that the strength of a cryptographic system is usually equal to its weakest link.

No aspect of the system design should be overlooked, from the choice algorithms to the key

distribution and usage policies [18, 19].Complex encryption function can be built by composing

several simple operations which offer complementary – but individually insufficient –

protection

• simple operations:

– elementary arithmetic operations

– logical operations (e.g., XOR)

– modular multiplication

– transpositions

– substitutions

2.5 Summary: Here the covered areas are briefing about the cryptography, a short discussion on the

types of the cryptography, also covering symmetric & asymmetric division of encryptions. A differential

calculation has also been made between symmetric & asymmetric encryption. Cryptanalysis & attacks are

also discussed and at the end the chapter is ended with the description of what should be the standards

cryptography algorithm.

Page | 22

Chapter 3

Literature Survey

Page | 23

3.1 Introduction: This chapter is the study of existing system and issues regarding the

existing system & there method of approach. In this detailed description of existing technique

have described like what is cryptography, how it‘s working, advantage and disadvantage and

more important thing security of information over public network. Moreover it describes the

performance parameter of information security in public network and how can it should be

improved. What is the approach of the already discovered research work and many more.

3.2 Literature: Here n number of numerous researches is under consideration. This literature

review looks at the research that has been published in the area of cryptography as it relates to network data

and global communications security. It compares and contrasts the research pointing out overall trends in

what has already been published on this subject. It analyzes the role that cryptography has played and will

play in the future relative to security. This review addresses cryptography around the central theme of the

security that it provides or should provide individuals, corporations, and others in the modern age of

computing technology, networking, and Web-based ecommerce. By reviewing both scholarly and non-

scholarly works, it is our objective to make a better approach that is continuing research into the use

of cryptography in preserving the future of electronic data security and privacy worldwide to be conducted

over the Internet.

3.3 Overall Trends in the Research: There is a prevailing myth that secrecy is good for

security, and since cryptography is based on secrets, it may not be good for security in a practical sense. The

mathematics involved in good cryptography is very complex and often difficult to understand, but many

software applications tend to hide the details from the user thus making cryptography a useful tool in

providing network and data security. Many companies are incorporating data encryption and data loss

prevention plans, based on strong cryptographic techniques, into their network security [17] strategic

planning programs. Cryptographic long-term security is needed but is often difficult to achieve.

Cryptography serves as the foundation for most IT security solutions, which include: Digital signatures that

are used to verify the authenticity of updates for computer operating systems, such as Windows XP; Personal

banking, ecommerce, and other Web-based applications that rely heavily on Secure Sockets Layer (SSL)

and Transport Layer Security (TLS) for authentication and data security. There are product design criteria

that designers can meet for implementing strong encryption protocols into software applications.

Although cryptography and information security are multi-billion dollar industries, the economy of the world

and the defense of almost every nation worldwide depend upon it and could not be carried out without it.

With the rise in threats to sensitive data from outsiders, encryption is seen as a necessary tool in ensuring

corporate networks and individuals information as secure as possible. The ubiquity of the Internet makes it

Page | 24

extremely difficult to trace and identify intruders of corporate networks with the public domain. Primary

security concerns are confidentiality, data integrity, data origin authenticity, agent authenticity, non-

repudiation, and so on. Current cryptographic techniques, such as smart cards, PINs, password authentication

have performed well in keeping data secure.

3.4 Literature Review: Till now few of the research have been analyzed those have conducted and

reported in the concerned area ,the decision after analysis was to choose two of the algorithms namely DJSA

& NJJSAA which are proposed by almost the same authors. By going through the work they proposed it

was found that they are using the same process for the key generation & almost the same process for the

encryption as well just on a contrary multiple encryption using bit exchange, bit right shift and XOR

operations makes the system of NJJSAA differ from DJSA. It is observed that the both of the

case are taking very huge mathematical calculations & the CPU process is also increased for the

same which leads to unnecessary encryption time consumption. It was also observed that

different algorithm have different proportion of power consumption while operating with a

given set of process.

1) 2011 International Conference on Communication Systems and Network Technologies

978-0-7695-4437-3/11 $26.00 © 2011 IEEE DOI 10.1109/CSNT.2011.25

A new Symmetric key Cryptography Algorithm using extended MSA method: DJSA

[1] symmetric key algorithm

Dripto Chatterjee Suvadeep Dasgupta Joyshree Nath Asoke Nath

In the present work the authors introduced a new symmetric key cryptographic method for

encryption as well as decryption of any file such as binary file, text file or any other file. Nath et.

al. developed an algorithm called MSA [19] for encryption and decryption of any file using a

random key square matrix containing 256 elements. The weak point of MSA algorithm is that if

any one applies the brute force method then he has to give a trial for factorial 256 to find the

actual key matrix. Now in the modern world this number of trial runs may not be impossible for

the hacker. To get rid of this problem here the authors suggest a better algorithm than MSA. In

the present method the authors considered the size of the key matrix to be 65536 and in each cell

we store 2 characters pattern instead of 1 character unlike MSA method. If someone wants to

give a brute force method to find our actual key then one has to give a trial for factorial 65536

runs! Theoretically this is an intractable problem. Moreover the authors have also introduced

multiple encryptions here to make the system more secured. This method will be suitable in any

business house, government sectors, communication network, defense network system, sensor

Page | 25

networks etc. In the present work the authors have introduced a square key matrix of size 256 by

256 where in each cell there are all possible 2-lettered words (ASCII code 0-255). The total

number of words possible is 65536. The key matrix is then randomized using the method

proposed by Nath et. al(1). The user has to enter some secret text-key. The maximum length of

the text key should be 16 characters long. To calculate the randomization number and the

number of encryption to be done is calculated from the text-key using a method proposed by

Nath et.al(1). The present method will be most suitable for encryption of a file whose size is less

than or equal to 2MB. If the file size is very big then we suggest choosing small encryption

number to speed up the system.

2) 2011 International Conference on Communication Systems and Network Technologies

978-0-7695-4437-3/11 $26.00 © 2011 IEEE DOI 10.1109/CSNT.2011.33

New Symmetric key Cryptographic algorithm using combined bit manipulation and

MSA encryption algorithm: NJJSAA symmetric key algorithm [2]

Neeraj Khanna Joyshree Nath Joel James Amlan Chakrabarti Sayantan Chakraborty

Asoke Nat

In the present work the authors have introduced a new advanced symmetric key cryptographic

method called NJJSAA. The authors introduced new bit manipulation method for data

encryption and decryption of any file. Nath et al already developed some symmetric key

methods where they have used some randomized key matrix for encryption and decryption

methods. In the present work the authors have used a bit manipulation method which include bit

exchange, right shift and XOR operation on the incoming bits. To exchange bits the authors used

a randomized key matrix of size (16x16) using the method developed by Nath et al. The present

method allows the multiple encryptions and multiple decryptions. To initiate the encryption

process a user has to enter a text-key which may be maximum of 16 characters long. From the

text-key the authors have calculated randomization number and the encryption number. The

method used was developed by Nath et al. A slight change in the text-key will change the

randomization number and the encryption number quite a lot. Multiple encryption using bit

exchange, bit right shift and XOR operations makes the system very secured. The present

method is a block cipher method and it can be applied to encrypt data in sensor network or in

mobile network. The advantage of the present method is that one can apply this method on top

of any other standard algorithm such as DES, AES or RSA. The method is suitable to encrypt

any large or small file. There is a scope to further enhance the present method of encryption.

Page | 26

Few literatures we took that describe the work already done in the Symmetric Key Cryptography

& related fields are explored are as follows:

3) International Journal of Computer Applications (0975 – 8887)

Volume 14– No.7, February 2011

Advanced Steganographic Approach for Hiding Encrypted Secret Message in LSB,

LSB+1, LSB+2 and LSB+3 Bits in Non standard Cover Files [3]

Joyshree Nath Sankar Das Shalabh Agarwal Asoke Nath

Here the authors have explored the standard method for hiding secret message inside standard

cover files such as image, audio or video files. In the present work we have shown how we can

hide secret message in encrypted form in some non standard cover files such as .exe, .com, .pdf,

.doc, .xls, .mdb, .ppt files. However, the size of the secret message must be very small in

comparison to cover file. The secret message is converted to encrypted form using MSA

algorithm and then we hide the encrypted message inside the non standard cover file.

4) International Journal of Network Security, Vol.11, No.2, PP.78{87, Sept. 2010

Evaluating the Effects of Symmetric Cryptography Algorithms on Power

Consumption for Different Data Types [7]

Diaa Salama Abdul Minaam1, Hatem M. Abdual-Kader2, and Mohiy Mohamed Hadhoud2

Technologies such as CPU and memory are increasing and so is their need for power, but battery

technology is increasing at a much slower rate, forming a \battery gap". Because of this, battery

capacity plays a major role in the usability of the devices. The increasing demand for services on

wireless [31] devices has pushed technical research into non ending ways to overcome these

limitations. This paper provides evaluation of six of the most common encryption algorithms

namely: AES (Rijndael), DES, 3DES, RC2, BlowFish, and RC6. We examine a method for

analyzing trade-o®s between energy and security. We suggest approach to reduce the energy

consumption of security protocols. A comparison has been conducted for those encryption

algorithms at different settings for each algorithm such as different sizes of data blocks, different

data types, battery power consumption, different key size and finally encryption/decryption

speed.

5) 2009 International Conference on Computational Intelligence and Security

Timing evaluation of the known cryptographic algorithms[12]

Yan Wang & Ming Hu

Page | 27

In this model for evaluation, there are two evaluating modes: different plaintexts in the same key

(DPSK), the same plaintext in different keys (SPDK). As the basis of the evaluating model, the

plaintext and the corresponding key are both generated by random numbers. The results show

that, under the same key length and for the same size of the processed data, RSA is about several

hundred times slower than AES, triple-DES is about three times slower than AES, and there are

other runtime characteristics which further highlights the difference between these three

cryptographic algorithm and provides a reference value of for people‘s rational using.

6) Ninth ACIS International Conference on Software Engineering, Artificial Intelligence,

Networking, and Parallel/Distributed Computing

Effect of Security Increment to Symmetric Data Encryption through AES

Methodology [14]

¹Md. Nazrul Islam, ¹Md. Monir Hossain Mia, 2Muhammad F. I. Chowdhury, 3M.A. Matin

The algorithm uniquely defines the mathematical steps required to transform data into a

cryptographic cipher and also totransform the cipher back to the original form. Data encryptions

standard (DES) use 64 bits block size as well as 64 bits key size that are vulnerable to

bruteforce, attack. But for both efficiency and security, a larger block size [5] is desirable. The

Advanced Encryption Standard (AES,) that uses 128 bit block size as well as 128 bits key size

was introduced by NIST. In this paper, we showed the effect in security increment through AES

methodology. To do this, we propose an algorithm which is higher secure than Rijndael

algorithm (by comparing the key size) but less efficient than that.

7) International Arab Journal of e-Technology, Vol. 2, No. 1, January 2011

Studying the Effects of Most Common Encryption Algorithms[4]

Diaa Salama, Hatem Abdual Kader and Mohiy Hadhoud

Encryption algorithms play vital roles in information systems security. Those algorithms

consume a significant amount of computing resources such as CPU time, memory, and battery

power The design of efficient secure protocols for wireless devices from the view of batter

consumption needs to understand how encryption techniques affect the consumption of battery

power with and without data transmission. This paper studies the effects of six of the most

common symmetric encryption algorithms on power consumption for wireless devices. at

different settings for each algorithm. These setting include different sizes of data blocks,

different datatypes (text, images, and audio file), battery power consumption, different key size,

different cases of transmission of the data, effect of varying signal to noise ratio and finally

Page | 28

encryption/decryption speed. The experimental results show the superiority of two encryption

algorithm over other algorithms in terms of the power consumption, processing time, and

throughput .These results can aid in new design of security protocol where energy efficiency is

the main focus.

3.5 Categorization: All the papers listed above are suggesting the method of encryption & decryption

performed by different algorithm. In most of the papers different approaches for encryption are given most of

them are symmetric that is they user the single key for encryption & decryption. The third paper provides

information for steganography technique and also covers the MSA algorithm technique. The forth

paper gives the idea of power consumption by different cryptography algorithms. Fifth gives a

keen timing evaluation of different algorithms. The last two papers gives AES methodology &

defines he cryptography transformation mathematical steps required for transformation to cipher

text and the last one gives the information for CPU utilization memory battery & other runtime

characteristic of the algorithms. From there contents the papers can be categorized into the

following categories:

i) Scientific

ii) Specific

iii) Overview

iv) General

The below table 3.1 is the categorization of the ‗scientific‘, ‗specific‘ ‗overview‘, & ‗general‘. Now these

categorization is done on behalf as if the paper belongs to the category of ‗scientific‘ it gives a good idea

about the research work done in the field and it also clearly describe the mathematical functions for

performing the process of encryption. If the paper belongs to ‗specific‘ it mean that it is only considering the

part of the per research work & nothing else. If the paper belong to the category of the ‗overview‘ then it is

there because the paper describe not only the related work but also the work related to the field suggested by

others. The paper only comes into category of ‗general‘ if it does not belong to any other field.

Page | 29

Literature No. Scientific Specific Overview General

1 √ √ √

2 √ √ √

3 √ √

4 √

5 √ √

6 √

7 √

Table 3.1 Categorization of Literatures

3.6 Conclusion: Paper 1 & 2 are related to each other 4, 5 & 6 are related & 7 describe the overview.

From the literature it can be concluded that the different approaches has been made by the different authors

for enhancing the security for the transmission of the information over a public network. It is also concluded

that further work can be done in the same field by proper research will be appreciated.

3.7 Summary: In this chapter the things which has been covered is the literature there introduction types

overall trend of research, literature review of seven different papers followed by a conclusion that further

research is much needed.

Page | 30

Chapter 4

Data Analysis: Analysis of Data &

Preparation of Information

Page | 31

4.1 Existing System: Here: A new Symmetric key Cryptography [32] Algorithm using

extended MSA method: DJSA symmetric key algorithm [1] is discussed. In the present work

they have proposed a symmetric key method where they used a random key generator for

generating the initial key and that key is used for encrypting the given source file. In that method

basically a substitution method where they take 4 characters from any input file and then search

the corresponding characters in the random key matrix file after getting the encrypted message

they store the encrypted data in another file. For searching characters from the random key

matrix they have used a method which was proposed by author in MSA algorithm. The

presented method has the provision for encrypting message multiple times. The key matrix

contains all possible words comprising of 2 characters each generated from all characters whose

ASCII code is from 0 to 255 in a random order. The pattern of the key matrix will depend on

text key entered by the user. They proposed an algorithm to obtain randomization number and

encryption number from the initial text key, they have given a long trial run on text key and

found that it is very difficult to match the above two parameters from 2 different Text key which

means if some one wants to break encryption method then he/she has to know the exact pattern

of the text key. To decrypt any file one has to know exactly what is the key matrix and to find

the random matrix theoretically one has to apply 65536 trial runs and which is intractable. It

applied that method on possible files such as executable file, Microsoft word file; excel file,

access database, fox-pro file, text file, image file, pdf-file, video file, audio file, oracle database.

Here another newly developed technique: New Symmetric key Cryptographic algorithm using

combined bit manipulation and MSA encryption algorithm: NJJSAA symmetric key algorithm

[2] is discussed. In this they have introduced a new advanced symmetric key cryptographic

method called NJJSAA. It introduced new bit manipulation method for data encryption [6] and

decryption of any file. Researches of the presented work have already developed some technique

where they used some randomized key matrix for encryption and decryption methods. In the

present work it used bit manipulation methods which include bit exchange, right shift and XOR

operation on the incoming bits. To exchange bits used a randomized key matrix of size (16x16).

The present method allows the multiple encryptions and multiple decryptions. To initiate the

encryption process a user has to enter a text-key which may be maximum of 16 characters long.

From the text-key calculated randomization number and the encryption number. A slight change

in the text-key will change the randomization number and the encryption number quite a lot.

Multiple encryption using bit exchange, bit right shift and XOR operations makes the system

very secured. The present method is a block cipher method and it can be applied to encrypt data

Page | 32

in sensor network or in mobile network. The advantage of the present method is that one can

apply this method on top of any other standard algorithm such as DES, AES [18] or RSA. The

method is suitable to encrypt any large or small file.

Encryption algorithms play vital roles in information systems security. Those algorithms

consume a significant amount of computing resources such as CPU time, memory, and battery

power. CPU and memory usability are increasing with a suitable rates, but battery technology is

increasing at slower rate. The problem of the slower increasing battery technology forms battery

gap [4]. The complexity of cryptography does not allow many people to actually understand the

motivations and therefore available for practicing security cryptography. Cryptography process

seeks to distribute an estimation of basic cryptographic primitives across a number of

confluences in order to reduce security assumptions on individual nodes, which establish a level

of fault-tolerance opposing to the node alteration. In a progressively networked and distributed

communications environment, there are more and more useful situations where the ability to

distribute a computation between a number of unlike network intersections is needed. The

reason back to the efficiency (separate nodes perform distinct tasks), fault-tolerance (if some

nodes are unavailable then others can perform the task) and security (the trust required to

perform the task is shared between nodes) that order differently. In [5] described and reviewed

the different research that has done toward text encryption [9] and description in the block

cipher. Moreover, in this suggested a cryptography model in the block cipher effect of varying

signal to noise ratio and finally encryption/decryption speed. In [11] provides evaluation of six

of the most common encryption algorithms namely: AES (Rijndael), DES, 3DES, RC2,

Blowfish, and RC6. This examine a method for analyzing trade-offs between energy and

security. Suggest approach to reduce the energy consumption of security protocols. In [12] A

new timing evaluation model based on random number generating mechanism is suggested to

analyze the time-consuming of the known cryptographic algorithms: triple-DES, AES and RSA.

In this model for evaluation, there are two evaluating modes: different plaintexts in the same key

(DPSK), the same plaintext in different keys (SPDK). As the basis of the evaluating model, the

plaintext and the corresponding key are both generated by random numbers. The results show

that, under the same key length and for the same size of the processed data, RSA is about several

hundred times slower than AES, triple-DES is about three times slower than AES, and there are

other runtime characteristics which further highlights the difference between these three

cryptographic algorithm and provides a reference value of for people‘s rational using. In [14] the

selective application of technological and related procedural safeguards is an important

responsibility of every organization in providing adequate security to its electronic data systems.

Page | 33

Protection of data during transmission or while in storage may be necessary to maintain the

confidentiality and integrity of the information represented by the data. The algorithm uniquely

defines the mathematical steps required to transform data into a cryptographic cipher and also to

transform the cipher back to the original form. Data encryptions standard (DES) use 64 bits

block size as well as 64 bits key size that are vulnerable to brute force, attack. But for both

efficiency and security, a larger block size is desirable. The Advanced Encryption Standard

(AES,) that uses 128 bit block size as well as 128 bits key size was introduced by NIST. In this

work, they showed the effect in security increment through AES methodology. To do this, they

proposed an algorithm which is higher secure than Rijndael algorithm (by comparing the key

size) but less efficient than that.

4.2 Problem Formulation of Existing System: This section presenting some drawback

and limitation of existing work which observed during study. According to existing work

generated key for encryption and decryption using large database in the form of file which is the

cause of poor efficiency. In this firstly created large sets of character which is store in file and

then selected key from those sets of character, this process is the time consuming process which

will decrease efficiency, and increase response time, battery power consumption, memory

utilization and many more. Further more points observed during survey which is following.

It is difficult to implement on small devices like smart card due to more code and cycles.

In software, the cipher and its inverse make use of different code and/or tables.

In DJSA [1] the generation of file size for key 256 X 256 X 2 perform unnecessary

calculations & hence very time consuming

In DJSA [1], generate some mathematical operation but they have not been used any

where in the whole process for even a single time which is sense less to generate them &

also time consuming, like Encryption Number (n2).

In DJSA [1] the randomization steps they perform like

i) Cycling function()

ii) Upshift function()

iii) Rightshift function ()

iv) Downshift function()

v) Leftshift function()

Page | 34

All the functions above mentioned cancel each other except a cycling function which also comes

back to its original positing after a certain no. of rounds. All these functions operations

performed are unnecessary taking CPU process & hence increase the time of the complete

encryption operation.

In DJSA [1] encryption/decryption is not possible for all cases because there is no proper

rule specified for encryption/decryption process. Maximum steps are only based

assumption.

In NJJSAA [2] since this work is a sort of the extension of the pervious work DJSA may

of the flaws are same which unnecessary increase the time of operation. There is no

proper rules are specified for the encryption process, maximum steps are based on the

assumption similarly in the decryption process.

In NJJSAA [2] Bit manipulation process is not clearly specified because the author has

asked to change each bit with the nth bit if this is done then the process can not be

continued because all the bits till now have been converted into nth bit.

In NJJSAA [2] at the time of bits shifting process nth bits is not specified in the

encryption process.

In NJJSAA [2] XOR operation can apply in encryption process but at the time of

decryption process this is not possible to recover original data because 256 bits would

already have been reduced in 128 bits by using XOR operation but there is no rule to

recover 256 bits from 128 bits.

4.3 Error in Encryption leads to Compromises: When message-handling operator

makes error in encrypting data. Compromises may occur during requested re-transmission in

these cases: This message can be encrypted using a different key. In any case, it is possible for

interceptors to compare the two cipher text and work out the encryption. Sometimes, two

different messages encrypted with the same key may also be fatal. When a request for

retransmission results in transmission of plaintext, instead of a repeat of the cipher text. The

gravity of this blunder is apparent when one considers how anyone could intercept the plaintext

message and compare this with the previously encrypted message, and therefore figure out the

encryption method and possibly, selection of key.

Probable Word: When important messages are relayed, often unimaginative choice of

words could give away the encryption, as specialists in the field of cryptography have

Page | 35

amassed a set of most probable words as the nature of the message exhibits. For instance,

in decoding love letters, frequency ordering looks for words such as ‗love, heart, fire,

miss, life, light‘ which are most frequently used. Hence it is important to rephrase

messages before they are encrypted and transmitted.

Special Characters: The use of certain clear symbols (or even nulls) for spacing or

punctuation has been proven disastrous for those who committed this sin. The double

appearance of certain important words could also give away the encryption.

Event-triggered Messages: Nothing can emphasize the importance of encrypting a

message well. The slightest carelessness may well reveal subsequent messages.

However, not having code books does not mean a message should be transmitted as

plaintext. On the other hand, encrypted messages containing obvious news, such as

weather report on certain phenomenon that is most obvious to the enemy, could prove to

be a fatal leak. Sometimes, the use of common phrase to describe a sudden, unforeseen

event may give away the encryption.

Poor Choice of Passwords: The use of commonly used, easily memorable phrases as

passwords is highly inadvisable, especially if these bear strong association with the

cryptanalyst.

Physical Copy of Crypt Documents: The presence of a physical copy of transmitted

data must be destroyed at all cost, since the most obvious, frequently practiced method of

interception is by physically seizing the crypt documents.

Captured Cryptographic Device: In military operations, whenever a particular

installation falls into the captivity of the enemy, the most important step to do would be

to secure or destroy any device or code books that are used to encrypt message.

Historically, failure to do this had brought about serious setbacks as enemies

eavesdropped easily to subsequent communications. During WW II, in many instances,

captured submarines or vessels left their encrypting devices intact, to the enemy's

advantage.

Illusion of Security Using 'Complicated' Cryptosystem: Altering existing methods by

introducing suitable superficial complications may well be a double-edged sword, as it

lulls cryptographer into a false sense of security.

Human Operator Errors: Most of encryption method that has been broken, was solved

as a result of a tiny error on the part of the cipher officer. As with Germany‘s ENIGMA

encryption, Stuart Milner-Barry wrote that if not for human errors, "[it] was intrinsically

a perfectly secure machine.

Page | 36

4.4 Analysis: Succinctly put, analysis is important because if it is not done correctly, it is not

possible to design or build the right product, and consequently the product does not enable the

users to do their work. A survey of references on analysis suggests that solving the wrong

problem is one of the most common errors in software development. This error accounts for a

huge number of unprofitable or unusable software products that has been produced in the past,

and continues to this day. The most prevalent cause of this error is poor understanding of the

problem to be solved by the impending software product. Without a clear analysis of the

problem, the tasks of formulating and prioritizing solutions are likely to lead to wrong

conclusions. Wrong conclusions result in unnecessary solutions to wrong or non-existent

problems. The resulting software products are unmarketable and/or unusable.

4.4.1 Requirement Analysis: The main purpose of system requirements analysis is to obtain a

detailed understanding well defined requirement of the system need as defined in project

origination and captured in the system case, and to break it down into different requirements,

which are then clearly defined, reviewed and agreed.

4.4.1.1 Hardware Requirement:-

Items Description

Processor Intel Pentium Dual Core 1.5 GHz.

Memory 1 GB

HDD 30 GB

4.4.1.2 Software Requirement: -

Items Description

OS Windows XP and Above

Software Application Dot.Net 2008 Full Version

Database Sql Server Express

Page | 37

4.4.2 Additional Requirement:-

These additional requirements will, if possible, be levied on a standard encryption

algorithm.

The algorithm will be easy implementable.

The algorithm will be no weak keys.

The algorithm will be easily modifiable for different levels of security, both

minimum and maximum requirements.

All operations will manipulate data in byte-sized blocks.

4.4.3 Functional Requirements: The proposed ―hybrid crypto system‖ will accept the text data

to be encrypted and return encrypted data & other files formats.

4.4.4 External Interface Requirements

User Interfaces: - The proposed software will include a graphical user interface for user

to interact with program. Various options will be available as combinations of button and

level with check box and radio button options and/or arguments.

Hardware Interfaces:- The Proposed algorithm will be efficiently implementable in

custom hardware as well as on general purpose large, medium and small sized processors

(for e.g. microprocessors, microcontrollers and smart cards respectively).

Software Interfaces: - The proposed software will be in Dot Net programming language

(and will execute on any system with its compiler has been ported to). The portability of

other software implementations will depend on portability of chosen programming

language.

4.5 Design Decision: - Based on the above parameters, there will design some decisions.

The algorithm will:

Manipulate data in large blocks, preferably 128 bits in size for symmetric.

Will have a 128-bit block size.

Use simple operations that are efficient on microprocessors: e.g., matrix.

If possible, will have no weak keys.

Page | 38

4.6 Architectural Strategies

Use Microsoft Visual studio 2008 (VB.Net) for development [43] [44] [45] [46] [47]

Because main focus on simpler and faster development.

Platform Independent & better support for graphical user interface.

Excellent tool support.

Simple and safer deployment.

4.7 DFD Zero Level for Encryption

Figure 4.1: Zero Level DFD for Encryption Process

4.8 DFD Zero Level for Decryption

Figure 4.2: Zero Level DFD for Decryption Process

Page | 39

4.9 Use Case Diagram for Proposed System.

Figure 4.3: Use Case Diagram for Proposed System

4.10 Use Case Diagram for Selection of Algorithm

Figure 4.4: Use Case Diagram for Selection of Algorithm

Page | 40

4.11 Class Diagram for Proposed System

Figure 4.5: Class Diagram for Proposed System

4.12 Key-Type Selection:

Why Symmetric Key: Symmetric or conventional encryption uses the same key to

encrypt as well as decrypt. This technique is conceptually and practically

straightforward. This leads to a number of benefits. Performance is relatively high. Also,

the study of symmetric encryption techniques is quite thorough. The drawbacks of

symmetric encryption stem from these attributes of simplicity and maturity.

There are two major aspects of a symmetric encryption system. The first is the

encryption algorithm and the second is the secret key used with the algorithm. The

algorithm itself is some sort of transformation that takes data, also called plaintext, and a

secret key and outputs encrypted data or cipher text. This cipher text and the same secret

key should also be able to be transformed again to recover the plaintext. The security of

such an algorithm is evaluated on how much the transformation depends on the secret

key to recover the plaintext. A strong algorithm should depend entirely on the key for

recovery in any practical situation. It should be noted that any symmetric algorithm, in

Page | 41

fact any keyed algorithm, is vulnerable to brute force attacks although some more than

others.

Performance: Performance of symmetric encryption algorithms benefits from this

conceptual simplicity. First, the maturity of symmetric encryption techniques has

resulted in a large body of research and public scrutiny that has constantly revised

symmetric algorithms to perform faster in practical implementation. Standards in

symmetric encryption have led to hardware implementations. Many symmetric

algorithms are targeted at a particular hardware implementation such as a particular

microprocessor. Normally, the transformations in such algorithms use operations that the

hardware does well: rotating bits, logical XOR, etc. This performance benefit is a double

edged sword. The faster an algorithm performs, the faster brute force attacks on these

algorithms may be performed. The size of the key space often becomes the determining

factor of the security of a particular algorithm after considering the soundness of the

algorithm

This look at brute force cracking should not lull us into believing that a good symmetric

algorithm with a sufficiently large key space is foolproof. The main drawbacks of

symmetric encryption do not stem from its susceptibility to brute force attacks; all keyed

cryptographic techniques exhibit this 'weakness.' The weakness of symmetric encryption

is inherent in the use of the same key to encrypt as well as decrypt. This design

necessitates sharing of the secret key. It is the process of sharing this key that is normally

attacked in a symmetric system. In summary, symmetric algorithms have high

performance but introduce the problem of sharing a secret key.

Why Not Asymmetric Key: An encryption algorithm is asymmetric if different, related

keys are used to encrypt and decrypt. This attribute makes the attributes of asymmetric

encryption mirror those of symmetric encryption. The benefit is the potential for strong

security of keying material. In this technique a key is used to perform one operation,

encrypting or decrypting, and the other key is used to perform the complementary

operation. This splitting of duties makes asymmetric encryption very powerful in the fact

that one of the keys, referred to as the private key, can remain known only to the owner

of that key for the life of the key. There is never any need to share the key with others

since any operations that a partner would like to perform with the private key holder

would be done with the other key, called the public key. Because of this, one can share

Page | 42

the public key openly without fear of the key being intercepted by enemies. If it were, the

only damage that could occur would be the ability to encrypt messages to the private key

holder. The private key is no stronger than a secret key in symmetric encryption of

similar length. It can be brute force attacked in the same manner as a symmetric key. The

pivotal difference is that a symmetric key necessarily must be shared between the

encrypting person and decrypting person.

Performance: Unfortunately, asymmetric techniques have relatively low performance.

Some also argue that there is a looming danger in asymmetric encryption due to its

immaturity compared to symmetric encryption.

4.13 Performance Factors: For an algorithm it is important to be efficient and secure.

Efficiency of an algorithm is computed on the bases of time complexity and space complexity.

Encryption Time

CPU Process Time

CPU Clock Cycles

Battery Power.

Memory

The encryption time [5] is considered the time that an encryption algorithm takes to produce a

cipher text from a plaintext. Encryption time is used to calculate the throughput of an encryption

scheme. It indicates the speed of encryption. The throughput of the encryption scheme is

calculated as the total plaintext in bytes encrypted divided by the encryption time.

The CPU process time is the time that a CPU is committed only to the particular process of

calculations. It reflects the load of the CPU. The more CPU time is used in the encryption

process, the higher is the load of the CPU [4-5]. The CPU clock cycles are a metric, reflecting

the energy consumption of the CPU while operating on encryption operations. Each cycle of

CPU will consume a small amount of energy [4-5].The memory deals with the amount of

memory space it takes for the whole process of encryption and decryption.

4.14 Summary: This chapter is summarized by covering the area which have the existing

system, problems regarding existing system a brief analysis of the requirements if further work

has to be introduced, design architectural case diagrams class diagrams are discussed. Finally the

key type selection by nature & the performance factors are covered.

Page | 43

Chapter 5

Proposed Work

Design & Implementation

Page | 44

5.1 Proposed Concept: In fig.5.1 the proposed symmetric cryptography algorithm the idea

will be based on block cipher concept where data block will divided into sub blocks of equal

length and then each sub block will encrypt using a special mathematical set of functions known

as Key with the help of proposed encryption algorithm. At the time of encryption or decryption

same key will use because symmetric in nature. Proposed Key length will (17 bytes) 136 bits to

(32 bytes) 256 bit long so that security of proposed algorithm will be very high. Proposed

algorithm is highly efficiently due to its simplicity. Here proposed algorithm will take less

amount of time in execution as compared to the other algorithms because only the required or

sufficient no. of functions work in whole process that are required for maintaining the secrecy

against the intruders. Figure 6.1 is presenting basic block diagram of proposed concept. In this

figure plain text will execute with proposed encryption algorithm and proposed encryption

algorithm will call to proposed key to produce cipher text. In reverse cipher text will execute

with proposed decryption algorithm [39] and this proposed decryption algorithm will call same

proposed key to produce plain text.

Fig 5.1: Block Diagram of Proposed Concept

Page | 45

5.2 System architecture: Figure 6.2 is showing architecture of proposed system. In this

figure proposed system will start with the help of start function then it will execute random

function, this function is divided in to two function, one is random number function and second

is encryption number function: where random number function will help to produced key value

when and encryption number function and key value(which is not the key but just a function(a

no.) which will be used in the algorithm at later final stage) will help in proposed algorithm

when it will execute. After executing all function, final result will produced in terms of cipher

text. Finally stop function will execute to terminate system.

Figure 5.2: Proposed System Architecture

Page | 46

5.3 Pseudo Code:

1. Select 16 bytes key value and arrange it in matrix of 4X4.

2. Select 1st 16 byte of plain text and arrange it in matrix of 4X4.

3. Apply column Shift function such that replace 1st column of key matrix with 2

nd

column of plaint text matrix.

4. Apply column Shift function such that replace 3rd

column of key matrix with 4th

column of plaint text matrix.

5. Apply single matrix conversion function such that put the element of plain text

matrix in continuous order of key matrix row wise by which 8X4 matrix produced.

6. Then apply permutation function such that matrix obtained in step 5 the plain text

column is obtained by writing the element of the 8th

row and the 7th

row in the reverse

order, 2nd

column is obtained by writing the element of 6th

and then the 5th row in

reverse order, 3rd and 4th

column are also obtained in same way.

7. Now apply column mixing column 1 & 2, and column 3 & 4 in result of step 6.

8. Apply transposition function in result of step 7 so it becomes 4x8 matrix.

9. Apply row mixing between 1&4, and 2&3 in result of step 8.

10. Repeat step 3 to 9 till Average of encryption No. and random number.

11. Exit

Elaboration: // ENCRYPTION

Loop for p = 0 to avg (Ran_No, Enc_No)

{

//Columan Shift

Loop for i = 0 To 3

Loop for j = 0 To 3

If (j == 0)

Then

Char s = ky[i, j];

ky [i, j] = txt[i, j + 1];

Txt [i, j + 1] = s;

Endif

If (j == 2)

Then

Char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

Endif

End Loop

End Loop

Page | 47

Char [,] temp = new char [8, 4];

Char [,] temp1 = new char [8, 4];

//Combine Operation

Loop for i = 0 To7

Loop for j = 0 To 3

If (i < 4)

Then

temp [i, j] = ky[i, j];

Otherwise

temp [i, j] = txt[i - 4, j];

Endif

End Loop

End Loop

//Permutation

Loop for i = 0 To 3

Loop for j = 0 To 8

If (j < 4)

Then

temp1 [j, i] = temp [7 - 2 * i, 3 - j];

Otherwise

temp1 [j, i] = temp [6 - 2 * i, 3 - (j - 4)];

Endif

End Loop

End Loop

// Column Shift

Loop for i = 0 To 4

Loop for j = 0 To 8

If (i == 0)

Then

Char s = temp1 [j, i];

temp1 [j, i] = temp1 [j, i + 1];

temp1 [j, i + 1] = s;

Endif

If (i == 2)

Then

Char s = temp1 [j, i];

temp1 [j, i] = temp1 [j, i + 1];

temp1 [j, i + 1] = s;

Endif

End Loop

Page | 48

End Loop

// Transpose Operation

Loop for i = 0 To 3

Loop for j = 0 To 7

temp2 [i, j] = temp1 [j, i];

End Loop

End Loop

// Row Mixing

Loop for i = 0 To 3

Loop for j = 0 To 7

if (i == 0)

Then

Char s = temp2 [i, j];

temp2 [i, j] = temp2 [i + 3, j];

temp2 [i + 3, j] = s;

Endif

If (i == 1)

Then

Char s = temp2 [i, j];

temp2 [i, j] = temp2 [i + 1, j];

temp2 [i + 1, j] = s;

Endif

End Loop

End Loop

Loop for i = 0 To 3

Loop for j = 0 To 7

If (j < 4)

Then

ky[i, j] = temp2[i, j];

Otherwise

txt[i, j - 4] = temp2[i, j];

End If

End Loop

End Loop

End Loop

//DECRYPTION

Loop for p = 0 To avg (Ran_No, Enc_No)

// Row Mixing

Loop for i = 0 To 3

Page | 49

Loop for j = 0 To 7

If (i == 0)

Then

Char s = temp2 [i, j];

temp2 [i, j] = temp2 [i + 3, j];

temp2 [i + 3, j] = s;

Endif

If (i == 1)

Then

Char s = temp2 [i, j];

temp2 [i, j] = temp2 [i + 1, j];

temp2 [i + 1, j] = s;

Endif

End Loop

End Loop

// Transpose Operation

Char [,] temp1 = new char [8, 4];

Loop for i = To 3

For (int j = 0; j < 8; j++)

temp1 [j, i] = temp2 [i, j];

End Loop

End Loop

//Column Shift

Loop for i = 0 To 3

Loop for j = 0 To 7

If (i == 0)

Then

Char s = temp1 [j, i];

temp1 [j, i] = temp1 [j, i + 1];

temp1 [j, i + 1] = s;

Endif

If (i == 2)

Then

Char s = temp1 [j, i];

temp1 [j, i] = temp1 [j, i + 1];

temp1 [j, i + 1] = s;

Endif

End Loop

End Loop

//Divide Matrix

Char [,] temp = new char [8, 4];

Loop for i = 0 To 3

Page | 50

Loop for j = 0 To 7

If (j < 4)

Then

temp [7 - 2 * i, 3 - j] = temp1[j, i];

Otherwise

temp [6 - 2 * i, 3 - (j - 4)] = temp1[j, i];

Endif

End Loop

End Loop

// Column Shift

Loop for i = 0 To 7

Loop for j = 0 To 3

If (i < 4)

Then

ky[i, j] = temp[i, j];

Otherwiise

txt[i - 4, j] = temp[i, j];

Endif

End Loop

End Loop

//

Loop for i = 0 To 3

Loop for j = 0 To 3

If (j == 0)

Then

Char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

Endif

if (j == 2)

Then

Char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

Endif

End Loop

End Loop

End Loop

Page | 51

5.4 Flow Chart of Random Function Generator: Figure 5.3 is presenting flow chart

of the random function. This flow chart is using a mathematical formula to calculating two

function one random number and second is encryption number function. These two function will

use at the time of the proposed encryption algorithm.

Figure 5.3: Flow Chart of the Random Function

Page | 52

5.4.1 Random number and Encryption Number Calculation:-

1) Define variable length from 1 to 16 and base value from 17 to 2.

Length

of

key(n)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

Base

value(b)

17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2

2) Calculate random number follow-up the following steps.

i) Calculate variable Total

Total = ∑ ASCII code ( char entered as key) * bm

= wxyz

ii) Calculate Random Value

Ran_Value = w * b1 + x * b2 + y * b3 + z * b4

iii) Now select another variable value V1 which will represent as a Random Number.

V1 = Mod (Total, Ran_Value)

V1 = xy

iv) If V1 == 0 then

Set V1 = Ran_Value1

Else if V1 > 64 then

Set V1 = V1 – 64

3) Calculate Encryption Number follow-up the following steps.

i) Calculate Encryption Value

Enc_Value1 = z * b1 + y * b2 + x * b3 + w * b4

m=1

n

Page | 53

ii) Now select another variable V2 which will represent as a Encryption Number.

V2 = Mod (Total, Enc_Value1)

V2 = xy

iii) If V2 = = 0 then

Set V2 = Enc_Value1

Else if V2 > 64 then

Set V2 = V2 – 64

4) Final result is Random Number and Encryption number in V1 and V2 respectively.

5) Exit.

5.5 Flow Chart of Proposed Encryption Algorithm:

Figure 5.4: Flow Chart of Proposed Encryption Algorithm

Page | 54

5.5.1 Encryption Algorithms:

1. Select 16 bytes key value

String Key [16];

2. Select 16 bytes plain text

String Text [16];

3. Arrange both values in matrix form.

Key [i][j] and Text [i][j];

4. Apply Column shifting

Col_Shift_Key [i][j] = Col_shift ( Key [i][j]);

Col_Shift_Text [i][j] = Col_shift ( Text [i][j]);

5. Apply Combine function.

Com [i][j] = ComB (Col_Shift_Key [i][j], Col_Shift_Text [i][j]);

6. Apply Permutation function.

Permu [i][j] = PerMut (Com [i][j]);

7. Apply Column Shifting.

Com_Col_Shift [i][j] = Com_Col_Shift (Permu [i][j]);

8. Apply transposition.

Trans [i][j] = TranS (Com_Col_Shift [i][j]);

9. Apply row mixing.

Row_Mix [i][j] = Row_Mix ( Trans [i][j]);

10. Repeat step 1 to 9 till Avg (Enc_Number, Ran_Number).

11. Cipher [i][j] = Row_Mix [i][j];

12. Exit.

Page | 55

5.6 Flow Chart of Proposed Decryption Algorithm:

Figure 5.5: Flow Chart of Proposed Decryption Algorithm

5.6.1Decryption Algorithms:

1. Select cipher text value

Cipher [i][j];

2. Apply row mixing.

Rev_Row_Mix [i][j] = Rev_Row_Mix ( Cipher [i][j]);

3. Apply transposition.

Trans [i][j] = TranS (Rev_Row_Mix [i][j]);

4. Apply Column Shifting.

Rev_Com_Col_Shift [i][j] = Rev_Com_Col_Shift (Trans [i][j]]);

5. Apply Permutation function.

Page | 56

Rev_Permu [i][j] = Rev_PerMut ( Rev_Com_Col_Shift [i][j]);

6. Apply Division function.

Div_Key [i][j] = Divi (Rev_Permu [i][j]);

Div_Text [i][j] = Divi (Rev_Permu [i][j]);

7. Apply Column shifting

Rev_Col_Shift_ Div_Key [i][j] = Rev_Col_shift (Div_ Key [i][j]);

Rev_Col_Shift_ Div_Text [i][j] = Rev_Col_shift (Div_ Text [i][j]);

8. Repeat step 1 to 8 till Avg (Enc_Number, Ran_Number).

9. Text [i][j] = Rev_Col_Shift_ Div_Text [i][j]

10. Exit.

5.7 Proposed Algorithm Steps: Steps of the proposed algorithm is described one by one

following.

1) Select 16 byte key value and arrange in matrix form in the following way

Key Matrix (KM) =

2) Select 16 byte Plain Text and arrange in matrix form in the following way

Plain Text Matrix (PT) =

K1 K2 K3 K4

K5 K6 K7 K8

K9 K10 K11 K12

K13 K14 K15 K16

PT1 PT 2 PT 3 PT 4

PT 5 PT 6 PT 7 PT 8

PT 9 PT 10 PT 11 PT 12

PT 13 PT 14 PT 15 PT 16

Page | 57

3) Arrange key value and Plain Text in following way

4) Apply Column Shifting Function in the following way:

v) Replace 1st column of KM with 2

nd column of PT

vi) Replace 3rd

column of KM with 4th

column of PT

5) Apply merging of both matrix in the following way (Single Matrix Conversion):

Put the element of Matrix TWO in the continuing order of Matrix ONE column

wise (i.e. the End element of Column 1st of Matrix ONE should be followed by

the First element of Column 1st of Matrix TWO).

K1 K2 K3 K4

K5 K6 K7 K8

K9 K10 K11 K12

K13 K14 K15 K16

PT1 PT 2 PT 3 PT 4

PT 5 PT 6 PT 7 PT 8

PT 9 PT 10 PT 11 PT 12

PT 13 PT 14 PT 15 PT 16

PT2 K2 PT4 K4

PT6 K6 PT8 K8

PT10 K10 PT12 K12

PT14 K14 PT16 K16

PT1 K1 PT 3 K3

PT 5 K5 PT 7 K7

PT 9 K9 PT 11 K11

PT 13 K13 PT 15 K15

PT2 K2 PT4 K4

PT6 K6 PT8 K8

PT10 K10 PT12 K12

PT14 K14 PT16 K16

PT1 K1 PT 3 K3

PT 5 K5 PT 7 K7

PT 9 K9 PT 11 K11

PT 13 K13 PT 15 K15

Page | 58

6) Apply Permutation function in the following way:

Here the first column is obtained by writing the elements of the eighth row and then the

seventh row in reverse order; similarly the other three columns are obtained by using the

sixth and fifth rows, and so on.

7) Apply column mixing function on 4 X 8 matrixes.

Here Column mixing is performed between 1,2 & 3,4

8) Performing transposing function on 4 X 8 matrixes into 8 X 4 matrix

9) Apply Row mixing function between R1,R4 & R2, R3.

K15 K7 K16 K8

PT15 PT7 PT16 PT8

K13 K5 K14 K6

PT13 PT5 PT14 PT6

K11 K3 K12 K4

PT 11 PT3 PT 12 PT4

K9 K1 K10 K2

PT9 PT1 PT 10 PT2

K7 K15 K8 K16

PT7 PT15 PT8 PT16

K5 K13 K6 K14 PT5 PT13 PT6 PT14

K3 K11 K4 K12

PT 3 PT11 PT4 PT12 K1 K9 K2 K10

PT1 PT9 PT2 PT10

K7 PT7 K5 PT5 K3 PT 3 K1 PT1 K15 PT15 K13 PT13 K11 PT11 K9 PT9

K8 PT8 K6 PT6 K4 PT4 K2 PT2

K16 PT16 K16 PT14 K12 PT12 K10 PT10

K16 PT16 K16 PT14 K12 PT12 K10 PT10

K8 PT8 K6 PT6 K4 PT4 K2 PT2

K15 PT15 K13 PT13 K11 PT11 K9 PT9 K7 PT7 K5 PT5 K3 PT 3 K1 PT1

Page | 59

10) Repeat process 3 to 9 till Average of random number and encryption number.

(To execute this step it was decided divide the matrix into two parts i.e. the 1st part will

comprise of 1,2,3,4 columns & will be treated as key matrix. The 2nd

part of the matrix

will comprise of 5,6,7,8 columns & will be treated as plain text.)

11) Exit.

5.8 Features of the Presented Algorithm:

Key-length from 17 bytes or 136 bits to 32 bytes or 256 bits

Key is brooked in to two 1st part which consist of 16 char. assist the plain text & the

remaining 16 char generates the random no. & encryption no.

Block-length from 16 to FILE_LENGTH

Security [40] levels from 1 to 7 by changing only one parameter

" 1 = quick: encryption/decryption requires 10μs

" 7 = slow: encryption/decryption requires 10s

Easy to understand No hidden features grouped.

Easy to implement on PC or workstation

Note: A large key-length makes it possible to choose a key which is easy to remember

5.8.1 Characteristics: On the basis of study of proposed encryption algorithm and crypto

analysis presenting characteristic of the proposed encryption algorithm which is following.

Characteristic of Algorithm:-

Our proposed key is variable in length varying from 136 bits to 256 bits which is larger;

this will enhance the security aspect of this algorithm and make them more secure than

other encryption Algorithms.

Proposed Key having n number of rounds which will depend on random number and

encryption number, it is also increasing security.

There is no constraint that only one key which is providing simple structure.

It is Simple.

It is efficient.

It is robust.

This Algorithm is much smaller in structure than the other algorithms and easy to

understand and implement.

Page | 60

It does not contain complex structure, control flow is well defined and looping structure

is minimized. Due to the following facts it takes very less time for execution.

The message is encrypted in the form of matrices of small sizes.

Response time of CPU is very less.

5.8.2 Possible weak-points of the algorithm:

A chosen plaintext attack may give sufficient information about the internal status of the

pseudo random-number generator.

Memory Consumption is high as compare other algorithm.

5.9 Cryptanalysis: In the literature of Cryptography, the general types of attacks on a cipher

are

1. Cipher text only attack (brute force attack)

2. Known plaintext attack

3. Chosen plaintext attack

4. Chosen cipher text attack

In the cipher under consideration, the keys K and plain text PT both put together are containing

2n2 numbers, wherein each number can be represented in terms of some binary bits. Thus the

key space is of size

216n^2

= (

210

) 1.6n^2

~ 104.8n^2

On assuming that the computation of the cipher with a specified pair of values of the keys takes

10-7 seconds, the time required for the brute force attack is obtained as

(104.8n^2

x 10-7

) / 356x24x60x60 =57 x ( 104.8n^2 x

10-15

)

= 57 x ( 104.8n^2-15

)

This shows that the time required for computation is several years when n>=2. Thus the cipher

cannot be broken by the cipher text only attack. In the case of known plaintext attack, it has as

many plaintext and cipher text pairs as require for attack. Here in this analysis, as the plaintext

undergoes several transformations on account of multiplication by the key matrices and

permutation, in each round of the iteration, before the plaintext becomes the cipher text, the on

Page | 61

linearity involved in the process does not allow any one to break the cipher. Intuitively choosing

a plaintext or a cipher text is an impossible one as the process involved in the cipher is a

complex one. Thus the cipher cannot be broken by chosen plaintext/cipher text attack. In the

light of the above discussion, it concludes that the cipher is a strong one.

5.10 Generated Case:

Step 1: Inserting key:Thisisciphertext4

Step 2: Convert key in to 4X4 matrix

t h i s

i s c I

p h e r

t e x t

Step 3: Inserting plain text

welcometothisins

Step 4: Convert plain text in to 4X4 matrix

w e l c

o m e t

o t h i

s i n s

Step 5: Taking together key matrix 4X4 & plain text 4X4 matrix

t h i s w e l c

i s c I o m e t

p h e r o t h i

t e x t s i n s

Step 6: Apply column shifting function on Key matrix and Text matrix

Page | 62

e h c s

m s t I

t h i r

I e s t

Step 7: Applying Permutation

x c t i

n e s t

t i e s

s o i m

e i r s

h l i c

p t h h

o w t e

Step 8: After Column Shifting

c x i t

e n t s

i t s e

o s m i

i e s r

l h c i

t p h h

w o e t

Step 9: After Transforming

w t l i

o i e c

o p h e

s t n x

Page | 63

c e i o i l t w

x n t s e h p o

i t s m s c h e

t s e i r i h t

Step 10: After Row mixing

t s e i r i h t

i t s m s c h e

x n t s e h p o

c e i o i l t w

Step 11: Repeat the steps 5 to 9 till the average of Key Value & Encryption no. (Which is

produced by the last char of the key i.e. after 16 char & here that is --4)

Step 12: After combining output delivered. Final text is written in the output file.

Step 13: Final Cipher text obtained is in the form encrypted char. form as

0111w1000110100101110000011101000110100001110011e11010000110l1010110100101100

0110110010101111000011100110110100101c1001001110o100011101000110m10010111e00t

00011101000110100001110011011010000110010101101001011000110110010101111000011

1t0011011010010h1110010i1110100100i0011100110110100101s110010011101000111c01000

110100101110000011101000110100001110011011010000110010101101001011000110i11001

p010h111100e001r1100110110t100e101x11001001110100

5.11 Summary: Here the portions which have been considered & discussed are the proposed

concept which has been used for the dissertation work system architecture flow chart of random

function generator & proposed encryption/decryption process. Detail of encryption algorithm

decryption algorithm. Steps of the proposed algorithm, a generated case for better explanation of

algorithm. Finally features characteristics possible weak points & cryptanalysis for the proposed

work is covered.

Page | 64

Chapter 6

User Manual &Results Analysis

Page | 65

6.1 User Manual: Hear proposed system (software) named AEDNCA is developed in .Net

programming language, to implement & compare the two existing & our proposed algorithm. In

this proposed system three algorithms are comparing with each other and comparing factors is

execution time in terms of encryption and decryption time.

Figure 6.1: Loading Page:

The software named AEDNCA starts from here & the loading of the software is initiated.

Figure 6.2: Login Page:

Used for the purpose to enhance the security so that only certified user can login

Page | 66

Figure 6.3: Introduction Page

A brief introduction of the algorithm & the software is given for the overview.

Figure 6.4: Home Page

This is the Home Page of the Software which contain

i) Algorithm Navigator for Selection of Different algorithms for performing encryption /

decryption

ii) File format on which anybody can per form the encryption / decryption operation

iii) Calculate Tabular & Graphical Comparison for different of files format

Page | 67

Figure 6.5: DJSA algorithm Home Page

This page is initiated when the user choose the first algorithm i.e. DJSA for performing

encryption / decryption.

Figure 6.6: Giving Key & Selection of file for encryption

Here the secret key is provided (should vary from 1 to 16 Char.)for the process & selection of

file for DJSA Symmetric key algorithm to perform encryption is done.

Page | 68

Figure 6.7: Successful Encryption & Data Base Entry

This message is displayed when the process of encryption is completed.& entry of the

encryption time is done in data base.

Figure 6.8: Giving Key & Selection of file for decryption:

Here selection of encrypted file for DJSA algorithm to perform decryption is done & also the

same secret key is provided to convert the cipher text to the plain text.

Page | 69

Figure 6.9: Successful Decryption & Data Base Entry:

This message is displayed when the process of decryption id completed & entry of the

decryption time is done in data base.

Figure 6.10: NJJSAA algorithm Home Page:

This page is initiated when the user choose the second algorithm i.e. DJSA for performing

encryption / decryption.

Page | 70

Figure 6.11: Giving Key & Selection of file for encryption

Here the secret key is provided (should vary from 1 to 16 Char.)for the process & selection of

file for NJJSAA Symmetric key algorithm to perform encryption is done.

Figure 6.12: Successful Encryption & Data Base Entry

This message is displayed when the process of encryption is completed. & entry of the

encryption time is done in data base.

Page | 71

Figure 6.13: Giving Key & Selection of file for decryption:

Here selection of encrypted file for NJJSAA algorithm to perform decryption is done & also the

same secret key is provided to convert the cipher text to the plain text

Figure 6.14: Successful Decryption & Data Base Entry:

This message is displayed when the process of decryption id completed. & entry of the

decryption time is done in data base.

Page | 72

Figure 6.15: Proposed Algorithm (PA) Home Page:

This page is initiated when the user choose the PA algorithm i.e. Proposed Algorithm for

performing encryption / decryption

Figure 6.16: Giving Key & Selection of file for encryption

Here the secret key is provided (size min. 17 char. & max. 32 char.) for the process & selection

of file for PA Symmetric key algorithm to perform encryption is done.

Page | 73

Figure 6.17: Successful Encryption & Data Base Entry

This message is displayed when the process of encryption is completed. & entry of the

encryption time & the original size of the file is done in data base.

Figure 6.18: Giving Key & Selection of file for decryption:

Here selection of encrypted file for PA algorithm to perform decryption is done & also the same

secret key is provided to convert the cipher text to the plain text

Page | 74

Figure 6.19: Successful Decryption & Data Base Entry:

This message is displayed when the process of decryption is completed. & entry of the

decryption time & recovery of the complete file is done in data base.

Page | 75

6.2 Result Analysis: Here, “The Proposed System” and existing system have been

implemented on a number of data files varying types of content and file sizes of a wide range.

In this proposed system three algorithms are comparing with each other and comparing factors

are execution time in terms of encryption and decryption time, CPU utilization, Memory

Utilization, Cost estimation, Error detection ratio. Basically proposed system is performing

encryption and decryption on several size files using same key. For experiment, proposed

system used desktop machine which. Configuration of that machine is Intel Pentium Dual Core

E2200 2.20 Ghz, 1 GB of RAM and Window-XP SP2, in which performance data is collected.

In the experiments, the system encrypts/decrypt a various type of data like text, image, word etc.

There are two parameters are calculating by the proposed system on is encryption time and

another is decryption time which is shown in table 5.1 to 5.6. In this proposed system has run an

n cycle (that is, the number of the evaluated plaintexts). In each cycle, same plaintexts are

respectively encrypted by existing system and “Proposed system” by copying them. Finally,

the outputs of the comparison system execution time, and measured in numeric form. Actually,

for an encryption algorithm, the execution time of encryption not only depends on the

algorithm‘s complexity, but also the key and the plaintext have certain impact.

6.2.1 Result Comparison (Tabular & Graphical): In this section comparative results are

presented in the form of tabular & graphical comparison in terms of time consumed by the three

different algorithms for the complete encryption or decryption process. In the graph the Blue

line indicates the DJSA algorithm, Green line indicates the NJJSAA algorithm & Red represent

the Proposed Algorithm (PA). According to the comparative, there is a tendency that encryption

/decryption time for proposed system and compared existing system increases with file size. But

required time for the encryption/decryption through Proposed System is much smaller than

encryption time for compared system

Page | 76

6.2.1.1 Text File Tabular Comparison of Encryption Time: -

S.No.

File Size

(kb)

DJSA

(milli sec.)

Proposed Algorithm

(milli sec.)

NJJSAA

(milli sec.)

1 1 29484 0 150

2 6 41484 150 125

3 44 100687 531 1674

4 27 61270 373 534

5 2 35375 120 310

6 53 113430 565 4234

7 3 38171 130 620

8 5 39468 150 125

9 16 50730 109 415

10 32 86460 473 876

11 45 102150 531 1873

12 47 106370 555 2133

13 56 118940 766 5165

14 58 123310 843 5265

15 9 43718 310 218

Table 6.1: Tabular Comparison of Text Encryption between Exiting and Proposed Algorithm

6.2.1.2 Text File Graphical Comparison of Encryption Time: -

Graph 6.1: Graphical Comparison of Text Files

Encryption between Exiting and Proposed Algorithm

Page | 77

6.2.1.3 Text File Tabular Comparison of Decryption Time: -

S.No.

File Size

(kb)

DJSA

(milli sec.)

Proposed Algorithm

(milli sec.)

NJJSAA

(milli sec.)

1 1 29484 0 150

2 6 41484 0 125

3 44 94687 265 1343

4 27 55500 109 333

5 2 35375 0 310

6 53 108420 359 4133

7 3 38171 0 460

8 5 39468 0 109

9 16 49734 109 237

10 32 81460 160 733

11 45 98150 265 1535

12 47 101370 331 2109

13 56 110430 394 5234

14 58 123310 475 5437

15 9 43406 310 234

Table 6.2: Tabular Comparison of Text Decryption between Exiting and Proposed Algorithm

6.2.1.4 Text File Graphical Comparison of Decryption Time: -

Graph 6.2: Graphical Comparison of Text file

Decryption between Exiting and Proposed Algorithm

Page | 78

6.2.2.1 Image File Tabular Comparison of Encryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 70 134375 1234 14625

2 6 40281 310 203

3 36 113212 536 3343

4 28 71109 156 2234

5 16 55859 620 1460

6 33 93243 343 2796

7 20 57359 930 1226

Table 6.3: Tabular Comparison of Image Encryption between Exiting and Proposed Algorithm

6.2.2.2 Image File Graphical Comparison of Encryption Time: -

Graph 6.3: Graphical Comparison of Image files

Encryption between Exiting and Proposed Algorithm

Page | 79

6.2.2.3 Image File Tabular Comparison of Decryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 70 125140 593 9171

2 6 42718 150 156

3 36 102250 278 2781

4 28 67328 125 1234

5 16 55515 460 718

6 33 78343 171 1796

7 20 60780 460 1109

Table 6.4: Tabular Comparison of Image Decryption between Exiting and Proposed Algorithm

6.2.2.4 Image File Graphical Comparison of Decryption Time: -

Graph 6.4: Graphical Comparison of Image files

Decryption between Exiting and Proposed Algorithm

Page | 80

6.2.3.1 Excel File Tabular Comparison of Encryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 40 67457 156 2109

2 20 54109 620 1140

3 49 87320 389 2811

4 55 95151 843 6887

5 25 59281 125 1390

6 27 62140 171 1812

7 75 143265 1390 17484

Table 6.5: Tabular Comparison of Excel Encryption between Exiting and Proposed Algorithm

6.2.3.2 Excel File Graphical Comparison of Encryption Time: -

Graph 6.5: Graphical Comparison of Excel files

Encryption between Exiting and Proposed Algorithm

Page | 81

6.2.3.3 Excel File Tabular Comparison of Decryption Time: -

S.NO. File Size DJSA Proposed Algorithm NJJSAA

1 40 80150 287 2140

2 20 54859 620 953

3 49 80158 273 2233

4 55 89150 437 6109

5 25 58750 930 1310

6 27 61620 109 1234

7 75 133460 687 10140

Table 6.6: Tabular Comparison of Excel Decryption between Exiting and Proposed Algorithm

6.2.3.4 Excel File Graphical Comparison of Decryption Time: -

Graph 6.6: Graphical Comparison of Excel files

Decryption between Exiting and Proposed Algorithm

Page | 82

6.2.4.1 MP3 File Tabular Comparison of Encryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 111 241795 10562 127121

2 223 484618 17468 247202

3 314 721109 27656 365687

4 31 65171 218 2453

5 40 74812 1328 3640

6 41 76416 1915 4140

7 80 146937 6171 68187

Table 6.7: Tabular Comparison of MP3 Encryption between Exiting and Proposed Algorithm

6.2.4.2 MP3 File Graphical Comparison of Encryption Time: -

Graph 6.7: Graphical Comparison of MP3 files

Encryption between Exiting and Proposed Algorithm

Page | 83

6.2.4.3 MP3 File Tabular Comparison of Decryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 111 121788 6734 61328

2 223 340812 10718 175484

3 314 521250 13140 194000

4 31 64984 140 1390

5 40 77343 887 2140

6 41 74812 1180 1343

7 80 135109 4187 5533

Table 6.8: Tabular Comparison of MP3 Decryption between Exiting and Proposed Algorithm

6.2.4.4 MP3 File Graphical Comparison of Decryption Time: -

Graph 6.8: Graphical Comparison of MP3 Files

Decryption between Exiting and Proposed Algorithm

Page | 84

6.2.5.1 Word File Tabular Comparison of Encryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 47 102531 890 7265

2 48 104227 901 7640

3 52 113111 931 10600

4 56 121376 1320 13562

5 71 147984 1578 22125

6 63 135376 1361 15781

7 55 119758 1800 12546

Table 6.9: Tabular Comparison of Word Encryption between Exiting and Proposed Algorithm

6.2.5.2 Word File Graphical Comparison of Encryption Time: -

Graph 6.9: Graphical Comparison of Word files

Encryption between Exiting and Proposed Algorithm

Page | 85

6.2.5.3 Word File Tabular Comparison of Decryption Time: -

S.No. File Size DJSA Proposed Algorithm NJJSAA

1 47 98375 406 4609

2 48 100350 587 4834

3 52 105593 593 5340

4 56 115120 703 8796

5 71 137656 890 12390

6 63 129445 787 8406

7 55 110774 646 7875

Table 6.10: Tabular Comparison of Word Decryption between Exiting and Proposed Algorithm

6.2.5.4 Word File Graphical Comparison of Decryption Time: -

Graph 6.10: Graphical Comparison of Word files

Decryption between Exiting and Proposed Algorithm

Page | 86

6.2.6.1 PDF File Tabular Comparison of Encryption Time: -

S.NO. File Size DJSA Proposed Algorithm NJJSAA

1 99 196406 2312 32328

2 82 175216 2546 23110

3 7 43171 150 234

4 9 42984 160 296

5 39 121477 140 4310

6 49 126853 793 7859

7 50 128426 943 12750

Table 6.11: Tabular Comparison of PDF Encryption between Exiting and Proposed Algorithm

6.2.6.2 PDF File Graphical Comparison of Encryption Time: -

Graph 6.11: Graphical Comparison of PDF files

Encryption between Exiting and Proposed Algorithm

Page | 87

6.2.6.3 PDF File Tabular Comparison of Decryption Time: -

S.NO. File Size DJSA Proposed Algorithm NJJSAA

1 99 175984 1250 16562

2 82 169453 1140 12154

3 7 43734 150 171

4 9 42593 160 187

5 39 160125 109 2250

6 49 115430 687 4656

7 50 121750 743 4859

Table 6.12: Tabular Comparison of PDF Decryption between Exiting and Proposed Algorithm

6.2.6.4 PDF File Graphical Comparison of Decryption Time: -

Graph 6.12: Graphical Comparison of PDF files

Decryption between Exiting and Proposed Algorithm

Page | 88

6.3 EFFICIENCY : The table shows encryption time [7] & it is considered as the time that

an encryption algorithm takes to produce a cipher test from plaintext. Encryption time is used to

calculate the throughput of an encryption scheme. It indicates the speed of encryption.

6.3.1 Efficiency Tabular Comparison :Here calculation of ―EFFICIENCY‖ in terms of

―THROUGHPUT‖ [4] is done.

The throughput of the encryption scheme is calculated as the total plaintext in bytes encrypted

divided by the encryption time taken.

The Colum of the Throughput table is abbreviated as follows:

A = File Type

B = File Size in kb

C = Converted Time for DJSA in Milli. Sec

D =.Throughput of DJSA (D=B/C)

E = Converted Time for NJJSAA in Milli. Sec.

F = Throughput of NJJSAA (F=B/E)

G = Converted Time for PA in Milli. Sec.

H = Throughput of PA ( H= B/G)

I = Result: The better "throughput is produced by"

Table 6.13: Tabular Comparison of Throughput

S. NO. A B C D=B/C E F=B/E G H=B/G I

1 txt 1 33906 2.95E-05 15 0.0667 0 0 PA

2 txt 6 41484 0.000145 125 0.048 15 0.4 PA

3 txt 44 100687 0.000437 1674 0.0263 531 0.0829 PA

4 txt 27 61027 0.000442 534 0.0506 373 0.0724 PA

5 txt 2 35375 5.65E-05 31 0.0645 12 0.1667 PA

6 txt 53 113043 0.000469 4234 0.0125 565 0.0938 PA

7 txt 3 38171 7.86E-05 62 0.0484 13 0.2308 PA

8 txt 5 39468 0.000127 125 0.04 15 0.3333 PA

9 txt 16 50073 0.00032 415 0.0386 109 0.1468 PA

10 txt 32 86046 0.000372 876 0.0365 473 0.0677 PA

11 txt 45 102015 0.000441 1873 0.024 531 0.0847 PA

12 txt 47 106037 0.000443 2133 0.022 555 0.0847 PA

Page | 89

13 txt 56 1108094 5.05E-05 5165 0.0108 766 0.0731 PA

14 txt 58 123031 0.000471 5265 0.011 843 0.0688 PA

15 txt 9 43718 0.000206 218 0.0413 31 0.2903 PA

16 img 70 134375 0.000521 14625 0.0048 1234 0.0567 PA

17 img 6 40281 0.000149 203 0.0296 31 0.1935 PA

18 img 36 113212 0.000318 3343 0.0108 536 0.0672 PA

19 img 28 71109 0.000394 2234 0.0125 156 0.1795 PA

20 img 16 55859 0.000286 1046 0.0153 62 0.2581 PA

21 img 33 93243 0.000354 2796 0.0118 343 0.0962 PA

22 img 20 57359 0.000349 1226 0.0163 93 0.2151 PA

23 mp3 111 25795 0.004303 127121 0.0009 10562 0.0105 PA

24 mp3 223 52618 0.004238 247202 0.0009 17468 0.0128 PA

25 mp3 314 73109 0.004295 365687 0.0009 27656 0.0114 PA

26 mp3 31 65171 0.000476 2453 0.0126 218 0.1422 PA

27 mp3 40 74812 0.000535 3640 0.011 1328 0.0301 PA

28 mp3 41 76416 0.000537 4140 0.0099 1915 0.0214 PA

29 mp3 80 146937 0.000544 68187 0.0012 6171 0.013 PA

30 pdf 99 196406 0.000504 32328 0.0031 2312 0.0428 PA

31 pdf 82 175216 0.000468 23011 0.0036 2546 0.0322 PA

32 pdf 7 43171 0.000162 234 0.0299 15 0.4667 PA

33 pdf 9 42984 0.000209 296 0.0304 16 0.5625 PA

34 pdf 39 121477 0.000321 4031 0.0097 140 0.2786 PA

35 pdf 49 129853 0.000377 7859 0.0062 793 0.0618 PA

36 pdf 50 128426 0.000389 12750 0.0039 943 0.053 PA

37 word 47 102531 0.000458 7265 0.0065 890 0.0528 PA

38 word 48 104227 0.000461 7640 0.0063 901 0.0533 PA

39 word 52 113111 0.00046 10060 0.0052 931 0.0559 PA

40 word 56 121376 0.000461 13562 0.0041 1032 0.0543 PA

41 word 71 147984 0.00048 22125 0.0032 1578 0.045 PA

42 word 63 135376 0.000465 15781 0.004 1361 0.0463 PA

43 word 55 119758 0.000459 12546 0.0044 1008 0.0546 PA

44 excel 40 67457 0.000593 2109 0.019 156 0.2564 PA

45 excel 20 54109 0.00037 1140 0.0175 62 0.3226 PA

46 excel 49 87032 0.000563 2811 0.0174 389 0.126 PA

Page | 90

47 excel 55 95151 0.000578 6887 0.008 843 0.0652 PA

48 excel 25 59281 0.000422 1390 0.018 125 0.2 PA

49 excel 27 62140 0.000435 1821 0.0148 171 0.1579 PA

50 excel 75 143265 0.000524 17484 0.0043 1390 0.054 PA

Total

5412802 0.030545 1069778 0.8991 90207 6.5452 PA

Process

Time

per kb

in milli.

Sec.

2190.53 432.933 36.506

Result: After comparing the different files format it was found that while considering the .xls

file, .txt file, .mp3 file, .pdf file, .doc file type the better efficiency was produced by the

proposed algorithm.

6.3.2 Efficiency Graphical Comparison

Graph 6.13: Comparison of Throughput between Exiting and Proposed Algorithm

Page | 91

6.4 Error Rate in All Three Algorithms:

C.D.F = CORRECT DECRYPTED FILE

I.D.F = INCORRECT DECRYPTED FILE

1. INCORRECT DECRYPTED RATE (I.D.R.) =

[TOTAL NO. OF FILES DECRYPTED – CORRECT DECRYPTED FILES] * 100

----------------------------------------------------------------------------------------

TOTAL NO. OF FILES DECRYPTED

2. CORRECT DECRYPTED RATE (C.D.R.) =

[TOTAL NO. OF FILES DECRYPTED – INCORRECT DECRYPTED FILES] * 100

----------------------------------------------------------------------------------------

TOTAL NO. OF FILES DECRYPTED

Table 6.14: Error Rate

S.No.

File

Name File size KB DJSA NJJSAA PA

A B C D F

1 txt 1 C.D.F C.D.F C.D.F

2 txt 6 C.D.F C.D.F C.D.F

3 txt 44 C.D.F C.D.F C.D.F

4 txt 27 C.D.F C.D.F C.D.F

5 txt 2 C.D.F C.D.F C.D.F

6 txt 53 C.D.F C.D.F C.D.F

7 txt 3 C.D.F C.D.F C.D.F

8 txt 5 C.D.F C.D.F C.D.F

9 txt 16 C.D.F C.D.F C.D.F

10 txt 32 C.D.F C.D.F C.D.F

11 txt 45 C.D.F C.D.F C.D.F

12 txt 47 C.D.F C.D.F C.D.F

13 txt 56 C.D.F C.D.F C.D.F

14 txt 58 C.D.F C.D.F C.D.F

15 txt 9 C.D.F C.D.F C.D.F

16 img 70 C.D.F C.D.F C.D.F

Page | 92

17 img 6 C.D.F C.D.F C.D.F

18 img 36 C.D.F C.D.F C.D.F

19 img 28 C.D.F C.D.F C.D.F

20 img 16 C.D.F C.D.F C.D.F

21 img 33 C.D.F C.D.F C.D.F

22 img 20 C.D.F C.D.F C.D.F

23 mp3 111 C.D.F C.D.F C.D.F

24 mp3 223 C.D.F C.D.F C.D.F

25 mp3 314 C.D.F C.D.F C.D.F

26 mp3 31 C.D.F C.D.F C.D.F

27 mp3 40 C.D.F C.D.F C.D.F

28 mp3 41 C.D.F C.D.F C.D.F

29 mp3 80 C.D.F C.D.F C.D.F

30 pdf 99 C.D.F C.D.F C.D.F

31 pdf 82 C.D.F C.D.F C.D.F

32 pdf 7 C.D.F C.D.F C.D.F

33 pdf 9 C.D.F C.D.F C.D.F

34 pdf 39 C.D.F C.D.F C.D.F

35 pdf 49 C.D.F C.D.F C.D.F

36 pdf 50 C.D.F C.D.F C.D.F

37 word 47 C.D.F C.D.F C.D.F

38 word 48 C.D.F C.D.F C.D.F

39 word 52 C.D.F C.D.F C.D.F

40 word 56 C.D.F C.D.F C.D.F

41 word 71 C.D.F C.D.F C.D.F

42 word 63 C.D.F C.D.F C.D.F

43 word 55 C.D.F C.D.F C.D.F

44 xcl 40 C.D.F C.D.F C.D.F

45 xcl 20 C.D.F C.D.F C.D.F

46 xcl 49 C.D.F C.D.F C.D.F

47 xcl 55 C.D.F C.D.F C.D.F

48 xcl 25 C.D.F C.D.F C.D.F

49 xcl 27 C.D.F C.D.F C.D.F

50 xcl 75 C.D.F C.D.F C.D.F

Page | 93

DJSA ERROR RATE NJJSAA ERROR RATE PA ERROR RATE

C.D.R I.D.R. C.D.R I.D.R. C.D.R I.D.R.

[(TOTAL NO.

OF FILES

DECRYPTED –

INCORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(TOTAL NO.

OF FILES

DECRYPTED –

CORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(TOTAL NO.

OF FILES

DECRYPTED –

INCORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(TOTAL NO.

OF FILES

DECRYPTED

– CORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(TOTAL NO.

OF FILES

DECRYPTED –

INCORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(TOTAL NO.

OF FILES

DECRYPTED

– CORRECT

DECRYPTED

FILES)/TOTAL

NO. OF FILES

DECRYPTED ]

* 100

[(50-

0)/50]*100 =

100

[(50-

50)/50]*100

= 0

[(50-

0)/50]*100 =

100

[(50-

50)/50]*100

= 0

[(50-

0)/50]*100 =

100

[(50-

50)/50]*100

= 0

Result: After comparing the different files format it was found that while considering the .xls

file, .txt file, .mp3 file, .pdf file, .doc file type the Error Rate of all the three algorithms are

same. It shows that the standard of the BLOCK CIPHER algorithm was not dropped any where

while changing the approach of the encryption.

Page | 94

6.5 Power Consumption by

Algorithms:

Figure 6.20: Battery Configuration considered for experiment

Battery Measurement of Energy Consumption

Energy consumption [4][7] for encryption and decryption can be measured in many ways. These

methods as follows:

The method used to measure energy consumption is to assume that an average amount of energy

is consumed by normal operations and to test the extra energy consumed by an encryption

algorithms. This method simply monitors the level of the percentage of remaining battery that

can computed by equations (1) & (2)

The battery life consumed in percentage for one run = Change in battery life /

the number of runs (1)

This is practically not possible for the small size file because there is literally no change in the

life of the battery for single run. N

Average battery Consumed per iteration= ∑Battery Consumed Per iteration / N (2)

Average battery Consumed per file in a database of 50 files =

N

∑ Battery Consumed Per encryption / N

This can be achieved by grouping the files.

Page | 95

6.5.1 Power Consumption Tabular Comparison

Table 6.15: Battery Power Consumption & Ave. Battery Consumed (ABC)

BATTERY CONSUMPTION IN THE ALGORITHMS (DJSA, NJJSAA, PA)

S NO.

File

na

me

File

siz

e

KB

Time

taken

in DJSA

Convert

ed

Time

for

DJSA in

Milli.

Sec.

Use

d

Pow

er

Time

taken

in

NJJSAA

Convert

ed

Time

for

NJJSAA

in Milli.

Sec.

Use

d

Pow

er

Time

taken

in PA

Convert

ed

Time

for PA

in Milli.

Sec.

Use

d

Pow

er

A B C D E F G H

1 txt 1 0:0:33:

906 33906

0:0:0:1

5 15 0:0:0:0 0

2 txt 6 0:0:41:

484 41484

0:0:0:1

25 125

0:0:0:1

5 15

3 txt 44 0:1:40:

687 100687

0:0:1:6

74 1674

0:0:0:5

31 531

4 txt 27 0:1:1:0

27 61027

0:0:0:5

34 534

0:0:0:3

73 373

5 txt 2 0:0:35:

375 35375

0:0:0:3

1 31

0:0:0:1

2 12

6 txt 53 0:1:53:

43 113043

0:0:4:2

34 4234

0:0:0:5

65 565

7 txt 3 0:0:38:

171 38171

0:0:0:6

2 62

0:0:0:1

3 13

8 txt 5 0:0:39:

468 39468

0:0:0:1

25 125

0:0:0:1

5 15

9 txt 16 0:0:50:

73 50073

0:0:0:4

15 415

0:0:0:1

09 109

10 txt 32 0:1:26:

46 86046

0:0:0:8

76 876

0:0:0:4

73 473

Page | 96

11 txt 45 0:1:42:

15 102015

0:0:1:8

73 1873

0:0:0:5

31 531

12 txt 47 0:1:46:

37 106037

0:0:2:1

33 2133

0:0:0:5

55 555

13 txt 56 0:1:58:

94

110809

4

0:0:5:1

65 5165

0:0:0:7

66 766

14 txt 58 0:2:3:3

1 123031

0:0:5:2

65 5265

0:0:0:8

43 843

15 txt 9 0:0:43:

718 43718

0:0:0:2

18 218

0:0:0:3

1 31

Total txt 40

4

208217

5 22745 4832

Total

Battery

used in

%

while

doing

process

on all

txt file

Intailly

Bettry:

100%

Finally

Bettry:

60%

40

Intailly

Bettry:

60%

Finally

Bettry:

26%

34

Intailly

Bettry:

100%

Finally

Bettry:

78%

22

16 img 70 0:2:14:

375 134375

0:0:14:

625 14625

0:0:1:2

34 1234

17 img 6 0:0:40:

281 40281

0:0:0:2

03 203

0:0:0:3

1 31

18 img 36 0:1:53:

212 113212

0:0:3:3

43 3343

0:0:0:5

36 536

19 img 28 0:1:11:

109 71109

0:0:2:2

34 2234

0:0:0:1

56 156

20 img 16 0:0:55:

859 55859

0:0:1:4

6 1046

0:0:0:6

2 62

21 img 33 0:1:33:

243 93243

0:0:2:7

96 2796

0:0:0:3

43 343

22 img 20 0:0:57: 57359 0:0:1:2 1226 0:0:0:9 93

Page | 97

359 26 3

Total img 20

9 565438 25473 2455

Total

Battery

used in

%

while

doing

process

on all

Img.

file

Intailly

Bettry:

80%

Finally

Bettry:

27%

53

Intailly

Bettry:

100%

Finally

Bettry:

58%

42

Intailly

Bettry:

58%

Finally

Bettry:

27%

31

23 mp

3

11

1

0:4:1:7

95 25795

0:2:7:1

21 127121

0:0:10:

562 10562

24 mp

3

22

3

0:8:4:6

18 52618

0:4:7:2

02 247202

0:0:17:

468 17468

25 mp

3

31

4

0:12:1:

109 73109

0:6:5:6

87 365687

0:0:27:

656 27656

26 mp

3 31

0:1:5:1

71 65171

0:0:2:4

53 2453

0:0:0:2

18 218

27 mp

3 40

0:1:14:

812 74812

0:0:3:6

40 3640

0:0:1:3

28 1328

28 mp

3 41

0:1:16:

416 76416

0:0:4:1

40 4140

0:0:1:9

15 1915

29 mp

3 80

0:2:26:

937 146937

0:1:8:1

87 68187

0:0:6:1

71 6171

Total mp

3

84

0 514858 818430 65318

Total

Battery

used in

%

while

Intailly

Bettry:

100%

Finally

Bettry:

28%

72

Intailly

Bettry:

100%

Finally

Bettry:

37%

63

Intailly

Bettry:

100%

Finally

Bettry:

41%

59

Page | 98

doing

process

on all

MP3

file

30 pdf 99 0:3:16:

406 196406

0:0:32:

328 32328

0:0:2:3

12 2312

31 pdf 82 0:2:55:

216 175216

0:0:23:

11 23011

0:0:2:5

46 2546

32 pdf 7 0:0:43:

171 43171

0:0:0:2

34 234

0:0:0:1

5 15

33 pdf 9 0:0:42:

984 42984

0:0:0:2

96 296

0:0:0:1

6 16

34 pdf 39 0:2:1:4

77 121477

0:0:4:3

1 4031

0:0:0:1

40 140

35 pdf 49 0:2:6:8

53 129853

0:0:7:8

59 7859

0:0:0:7

93 793

36 pdf 50 0:2:8:4

26 128426

0:0:12:

750 12750

0:0:0:9

43 943

Total pdf 33

5 837533 80509 6765

Total

Battery

used in

%

while

doing

process

on all

PDF file

Intailly

Bettry:

100%

Finally

Bettry:

34%

66

Intailly

Bettry:

100%

Finally

Bettry:

49%

51

Intailly

Bettry:

49%

Finally

Bettry:

21%

28

37 wor

d 47

0:1:42:

531 102531

0:0:7:2

65 7265

0:0:0:8

90 890

38 wor

d 48

0:1:44:

227 104227

0:0:7:6

40 7640

0:0:0:9

01 901

Page | 99

39 wor

d 52

0:1:53:

111 113111

0:0:10:

60 10060

0:0:0:9

31 931

40 wor

d 56

0:2:1:3

76 121376

0:0:13:

562 13562

0:0:1:3

2 1032

41 wor

d 71

0:2:27:

984 147984

0:0:22:

125 22125

0:0:1:5

78 1578

42 wor

d 63

0:2:15:

376 135376

0:0:15:

781 15781

0:0:1:3

61 1361

43 wor

d 55

0:1:59:

758 119758

0:0:12:

546 12546 0:0:1:8 1008

Total wor

d

39

2 844363 88979 7701

Total

Battery

used in

%

while

doing

process

on all

Word

file

Intailly

Bettry:

100%

Finally

Bettry:

57%

43

Intailly

Bettry:

62%

Finally

Bettry:

34%

28

Intailly

Bettry:

34%

Finally

Bettry:

15%

19

44 xcl 40 0:1:7:4

57 67457

0:0:2:1

09 2109

0:0:0:1

56 156

45 xcl 20 0:0:54:

109 54109

0:0:1:1

40 1140

0:0:0:6

2 62

46 xcl 49 0:1:27:

32 87032

0:0:2:8

11 2811

0:0:0:3

89 389

47 xcl 55 0:1:35:

151 95151

0:0:6:8

87 6887

0:0:0:8

43 843

48 xcl 25 0:0:59:

281 59281

0:0:1:3

90 1390

0:0:0:1

25 125

49 xcl 27 0:1:2:1

40 62140

0:0:1:8

12 1821

0:0:0:1

71 171

Page | 100

50 xcl 75 0:2:23:

265 143265

0:0:17:

484 17484

0:0:1:3

90 1390

Toal xcl 29

1 568435 33642 3136

Total

Battery

used in

%

while

doing

process

on

allExcel

file

Intailly

Bettry:

100%

Finally

Bettry:

44%

56

Intailly

Bettry:

44%

Finally

Bettry:

4%

40

Intailly

Bettry:

69%

Finally

Bettry:

46%

23

Grand

Total

24

71

541280

2 277

106977

8 216 90207 151

Avg.

Battery

Consu

med

per file

for the

Data

base of

50 files

5.54 4.32 3.02

Result: After comparing the different files format it was found that while considering the .xls

file, .txt file, .mp3 file, .pdf file, .doc file type the least power was consumed by the proposed

algorithm

6.5.2 Power Consumption Graphical Comparison

Page | 101

Graph 6.14: Comparison of Battery Power Consumption

Between Exiting and Proposed Algorithm

6.6 Summary: This chapter contains the complete user manual. It also contains the result

produced by the different algorithms for different six file formats. An analysis of the result has

been done by making a data base of 50 file of random size and encrypting & decrypting all the

files individually. By doing so we have analyzed the time consumption for doing encryption

process & decryption process of the different algorithm generated for sex different file formats

which clearly indicated that the PA gives many time better results then the existing ones. Also

the tabular & graphical comparison has made among all file formats .The efficiency Throughput,

error rate of the three algorithms and power consumption made by the three algorithms is also

compared & every aspect the result produced show that the PA the proposed algorithm gives

may time better result then the existing ones.

Page | 102

Chapter 7

Conclusion & Future Scope

Page | 103

8.1 Conclusion: Developed research will present performance evaluation of selected

symmetric encryption algorithms. The selected algorithms will be DJSA symmetric key

algorithm and NJJSAA symmetric key algorithm. Several points will include in the simulation

results. First; there will no significant difference when the results will display either in

hexadecimal base encoding or in base 64 encoding. Secondly; in the case of changing packet

size, it will concluded that proposed algorithm will be produce better performance than other

common encryption algorithms used. Third; in the case of changing data type such as image,

audio or video instead of text, it will found proposed algorithm will be produce better

performance than other common encryption algorithms used in terms of time consumption.

Finally in the case of changing key size it will denote that higher key size leads to clear change

in the battery and time consumption.

It may further be concluded that the throughput, power consumption, CPU process utilization,

CPU clock cycle & run time memory utilization are the factors which have been very efficiently

developed & give extraordinary output as compared with the existing ones.

Page | 104

8.2 Application: The above system developed can be useful in application were the data base

security is performed.

Banking system – Various type of information is over public network.

Defense system – Secure transmission i.e. protecting against the enemy.

Finance system – Most useful in this area various transactions are done via public

network.

Educational System- Database of student is maintaining online.

8.3 Limitation: Following are certain limitation in the proposed system.

It would only run on all windows based operating system. Because tool used is dot

net language and it cannot be worked on any other operating system except

windows.

The end user who is going to use this application should have dot net framework

installed in his machine; otherwise he can‘t able to run this application on his

machine.

8.4 Future Enhancement:

Proposed System can use more complex operation to increase security level.

Various algorithms can be applied randomly instead of using constant algorithm it

can use random order algorithm for compression and encryption.

Try to lower the cipher text file size.

It may also be tried to make the system asymmetric in nature.

8.5 Summary: It is concluded here in this chapter that the developed research is many times

better in performer as compared to the existing ones in various aspects, and hence the work done

is successful. This dissertation is very useful for the filed and can provide a great guideline for

the other researchers. The chapter also gives a idea for implementing the work in various fields

in terms of its application. Limitations of the system is also explored .Finally the future work

which can be tried to achieved more better results in the coming future is given.

Page | 105

List of Publications

Page | 106

International Journals

1) Suyash Verma, Rajnish Choubey, Roopali Soni “Proposed Model Of New symmetric Key

Cryptography Algorithm” International Journal Of Emerging Technologies And Applications

In Engineering Technology And Science (IJETAETS) ISSN No. 0974-3588 | July ‘12 –

December ‘12 | Volume 5, Issue 2 pp 147-150.

2) Suyash Verma, Rajnish Choubey, Roopali Soni “An Efficient Developed New Symmetric

Key Cryptography Algorithm for Information Security" International Journal Of Emerging

Technology and Advance Engineering (IJETAE), ISSN 2250–2459 (Online) website:

http://www.ijetae.com/files/Volume2Issue7/IJETAE_0712_03.pdf | Volume 2 Issue-7 July

2012.

3) Suyash Verma, Rajnish Choubey, Roopali Soni “Design & Implementation of New

Encryption Algorithm Based on Block Cipher Substitution Technique ( Effect on Image

file)" International Journal Of Computer Technology And Electronics

Communication (IJCTEC) | Volume 1 Issue-1 October 2012.

National Conference

1) Suyash Verma, Rajnish Choubey, Roopali Soni “Design & Implementation of New

Encryption Algorithm Based on Block Cipher Substitution Technique ( Effect on Image

file) Using Neural Network” National Conference at Millennium College of Technology

NSAI-2012 on Artificial Intelligence place Bhopal Dt. 22nd

Sep 2012.

Page | 107

References, Web References & Bibliography

Page | 108

REFERENCES:

[1] Dripto Chatterjee, Joyshree Nath, Suvadeep Dasgupta, Asoke Nath ―A new Symmetric key

Cryptography Algorithm using extended MSA method: DJSA symmetric key algorithm‖

published in 2011 International Conference on Communication Systems and Network

Technologies, 978-0-7695-4437-3/11 $26.00 © 2011 IEEE

[2] Neeraj Khanna, Joyshree Nath, Joel James, Amlan Chakrabarti, Sayantan Chakraborty and

Asoke Nath ‖ New Symmetric key Cryptographic algorithm using combined bit manipulation

and MSA encryption algorithm: NJJSAA symmetric key algorithm‖ IEEE International

Conference on Communication Systems and Network Technologies 2011.

[3] Joyshree Nath, Sankar Das, Shalabh Agarwal and Asoke Nath ―Advanced Steganographic

Approach for Hiding Encrypted Secret Message in LSB, LSB+1, LSB+2 and LSB+3 Bits in

Non standard Cover Files‖ International Journal of Computer Applications (0975 – 8887)

Volume 14– No.7, February 2011

[4] Diaa Salama, Hatem Abdual Kader, and Mohiy Hadhoud ―Studying the Effects of Most

Common Encryption Algorithms‖ International Arab Journal of e-Technology, Vol. 2, No. 1,

January 2011

[5] Ashwak M. AL-Abiachi, Faudziah Ahmad and Ku Ruhana ―A Competitive Study of

cryptography Techniques over Block Cipher” UKSim 13th IEEE International Conference on

Modelling and Simulation 2011

[6] Artan LUMA and Nderim ZEQIRI ―Data Encryption and Decryption Using ANZL

Algorithm‖ 2010.

[7] Diaa Salama Abdul Minaam, Hatem M. Abdual-Kader, and Mohiy Mohamed Hadhoud

―Evaluating the Effects of Symmetric Cryptography Algorithms on Power Consumption for

Different Data Types‖ International Journal of Network Security, Vol.11, No.2, PP.78-87, Sept.

2010

[8] Fauzan Saeed, Mustafa Rashid ―Integrating Classical Encryption with Modern Technique‖

IJCSNS International Journal of Computer Science and Network Security, VOL.10 No.5, May

2010

[9] R. Venkateswaran Dr. V. Sundaram ―Information Security: Text Encryption and Decryption

with poly substitution method and combining the features of Cryptography‖ International

Journal of Computer Applications (0975 – 8887)Volume 3 – No.7, June 2010

[10] Akhil Kaushik, Manoj Bamela and AnantKumar ―Block Encryption Standard for Transfer

of Data‖ IEEE International Conference on Networking and Information Technology 2010.

Page | 109

[11] Diaa Salama Abdul Minaam, Hatem M. Abdual-Kader, and Mohiy Mohamed Hadhoud

―Evaluating the Effects of Symmetric Cryptography Algorithms on Power Consumption for

Different Data Types‖ International Journal of Network Security, Vol.11, No.2, PP.78{87, Sept.

2010.

[12] Yan Wang Ming Hu ―Timing evaluation of the known cryptographic algorithms‖ IEEE

International Conference on Computational Intelligence and Security 2009

[13] D. S. Abdul. Elminaam, H. M. Abdul Kader and M. M. Hadhoud ―Evaluating the Effects of

Cryptography Algorithms on power consumption for wireless Devices‖ International Journal of

Computer Theory and Engineering, Vol. 1, No. 3, August, 2009 1793-8201

[14] Md. Nazrul Islam, Md. Monir Hossain Mia, Muhammad F. I. Chowdhury, M.A. Matin

―Effect of Security Increment to Symmetric Data Encryption through AES Methodology‖ Ninth

ACIS International Conference on Software Engineering, Artificial Intelligence, Networking,

and Parallel/Distributed Computing 2008

[15] Diaa Salama Abdul. Elminaam, Hatem Mohamed Abdul Kader and Mohie Mohamed

Hadhoud ―Performance Evaluation of Symmetric Encryption Algorithms‖ IJCSNS International

Journal of Computer Sci 280 ence and Network Security, VOL.8 No.12, December 2008.

[16] Prepared by: Lee Kah Hui ―Developing A New Robust Private Key Encryption Algorithm‖

[17] Alexandra (Sasha) Boldyreva ―Computer and Network Security Cryptography

Introduction‖.

[18] Paul D. Yacoumis ―On The Security Of The Advanced Encryption Standard‖

[19] Somdip Dey Joyshree Nath Joyshree Nath ― An Integrated Symmetric Key Cryptographic

Method – Amalgamation of TTJSA Algorithm , Advanced Caesar Cipher Algorithm, Bit

Rotation and Reversal Method: SJA Algorithm‖ I.J.Modern Education and Computer Science,

2012, 5, 1-9

Web References:

[20] http://library.thinkquest.org/27158/history.html

[21] http://jobsearchtech.about.com/od/historyoftechindustry/g/Cryptography.html

[21] http://library.thinkquest.org/27158/history.html

[22] http://jobsearchtech.about.com/od/historyoftechindustry/g/ Cryptography.html

[23] en.wikipedia.org/wiki/Cryptography

[24]www.cryptography.com/

[25]www.cryptographyworld.com/

Page | 110

[26]www.cryptography.org/

[27] http://www.cs.nyu.edu/courses/spring07/G22.3033-013/index.html

[28] http://www.ciphersbyritter.com/LEARNING.HTM

[29] http://stackoverflow.com/questions/2844630/how-to-build-this-encryption-system-that-

allows-multiple-users-objects

Bibliography:

[30] William stallings, ―Cryptography and Network Security: Principles & Practices‖, second

edition.

[31] Hardjono, ''Security In Wireless LANS And MANS,'' Artech House Publishers.

[32]A Handbook of Applied Cryptography by Alfred J. Menezes,Paul C. Van Oorschot and

Scott A. Vanstone, CRC Press Series on Discrete Mathematics and Its Applications

[33] Foundations of Cryptography (Basic Tools) Oded Goldreich Cambridge 2001

[34] Cryptography and Network Security: Principles and Practice, by William Stallings. (3rd

edition)

[35] Applied Cryptography: Protocols, Algorithms, and Source Code in C Schneier, Bruce.

1995, 2nd

edition.

[36] Data Structures, Algorithm and Application in C++ by Sartaj Sahni.

[37] Art of Computer Programming Volume2. The: Semi numerical Algorithms Knuth,

DonaldE. 1998, 3rd edition.

[38] Code Breakers: The Comprehensive History of Secret Communication from Ancient Times

to the Internet. Kahn, David. 1996, Revised edition.

[39]Cryptography Decrypted Mel, H. X. / Baker, Doris. 2001.

[40] Cryptography and Data Security Denning, Dorthy. 1982.

[41] Introduction to Algorithms Cormen, Thomas H. / Leiserson, Charles E. / Rivest, Ronald L.

1990, 1st edition.

[42] Computer Security: Art and Science Bishop, Matt.

[43] C# 2008 Programming: Covers .NET 3.5 Black Book, Platinum Ed.

[44] Professional Asp .NET 2.0 Evjen, Hanselman, Rader

[45] Understanding .NET, Update for .NET Framework 2.0 Second Edition David Chappell.

[46] Beginning C# 2008 From No Voice to Professional Christian Gross

[47] Murach‘s ASP. NET 3.5 Web Programming with C# 2008 Anne Boehm & Joel Murach

Page | 111

Appendix I

Cryptography: the art or science encompassing the principles and methods of transforming an

intelligible message into one that is unintelligible, and then retransforming that message back to

its original form

Plaintext: the original intelligible message

Cipher text: the transformed message

Cipher: an algorithm for transforming an intelligible message into one that is unintelligible by

transposition and/or substitution methods

Key: some critical information used by the cipher, known only to the sender & receiver

Encipher (encode): the process of converting plaintext to cipher text using a cipher and a key

Decipher (decode): the process of converting cipher text back into plaintext using a cipher and a

key

Cryptanalysis: the study of principles and methods of transforming an unintelligible message

back into an intelligible message without knowledge of the key. Also called code breaking

Cryptology: both cryptography and cryptanalysis

Code: an algorithm for transforming an intelligible message into an unintelligible one using a

code-book

Concept:

Encryption C = E_(K)(P)

Decryption P = E_(K)^(-1)(C)

E_(K) is chosen from a family of transformations known as a cryptographic system.

The parameter that selects the individual transformation is called the key K, selected from a

keyspace K

More formally a cryptographic system is a single parameter family of invertible

transformations

E_(K) ; K in K : P -> C with the inverse algorithm E_(K)^(-1) ; K in K : C -> P such that the

inverse is unique

Usually assume the cryptographic system is public, and only the key is secret information

Private-Key Encryption Algorithms

a private-key (or secret-key, or single-key) encryption algorithm is one where the sender

and the recipient share a common, or closely related, key

all traditional encryption algorithms are private-key

overview of a private-key encryption system and attacker

Page | 112

Cryptanalytic Attacks

have several different types of attacks

Cipher text only

only have access to some enciphered messages

use statistical attacks only

Known plaintext

know (or strongly suspect) some plaintext-cipher text pairs

use this knowledge in attacking cipher

Chosen plaintext

can select plaintext and obtain corresponding cipher text

use knowledge of algorithm structure in attack

Chosen plaintext-cipher text

can select plaintext and obtain corresponding cipher text, or select cipher text and obtain

plaintext

allows further knowledge of algorithm structure to be used

Unconditional and Computational Security

two fundamentally different ways ciphers may be secure

Unconditional security

- no matter how much computer power is available, the cipher cannot be broken

Computational security

- Given limited computing resources (eg time needed for calculations is greater than age

of universe), the cipher cannot be broken

Page | 113

Appendix II

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Globalization;

using System.IO;

using System.Data.SqlClient;

using System.Security.Cryptography;

namespace WindowsFormsApplication1

{

public partial class Form3 : Form

{

public Form3()

{

InitializeComponent();

}

byte[] kk1 = new byte[8];

byte[] bb = new byte[8];

Int64 Calculate_Sum(string Secret_Key)

{

// Creating Base Table

int Base_Value;

Int64 Sum = 0;

Base_Value = 18 - Secret_Key.Length;

for (int i = 1; i <= Secret_Key.Length; i++)

{

int ascii = (int)Secret_Key[i - 1];

Sum += Int64.Parse((ascii * Math.Pow(double.Parse(Base_Value.ToString()),

double.Parse(i.ToString()))).ToString());

}

return Sum;

}

int Calculate_Random_Number(Int64 Sum)

{

int num1 = 0;

Int64 temp = Sum;

int length = Sum.ToString().Length;

while (temp != 0)

{

int digit = int.Parse((temp % 10).ToString());

num1 += digit * length--;

temp = temp / 10;

}

int n1 = int.Parse((Sum % num1).ToString());

if (n1 == 0)

{

n1 = num1;

Page | 114

}

if (n1 > 32)

{

n1 = n1 % 32;

}

return n1;

}

int Calculate_Encryption_Number(Int64 Sum)

{

int num2 = 0;

Int64 temp = Sum;

int length = 1;

while (temp != 0)

{

int digit = int.Parse((temp % 10).ToString());

num2 += digit * length++;

temp = temp / 10;

}

int n2 = int.Parse((Sum % num2).ToString());

if (n2 == 0)

{

n2 = num2;

}

if (n2 > 3)

{

n2 = n2%3;

}

return n2;

}

private void button1_Click(object sender, EventArgs e)

{

}

private void button4_Click(object sender, EventArgs e)

{

openFileDialog1.ShowDialog();

textBox2.Text = openFileDialog1.FileName;

}

public Bitmap CreateNonIndexedImage(Image src)

{

Bitmap newBmp = new Bitmap(src.Width, src.Height,

System.Drawing.Imaging.PixelFormat.Format32bppArgb);

using (Graphics gfx = Graphics.FromImage(newBmp))

{

gfx.DrawImage(src, 0, 0);

}

return newBmp;

}

private void button2_Click(object sender, EventArgs e)

{

Page | 115

#region Encryption

string time = "";

string y = "";

string val1 = "";

if (radioButton1.Checked == true)

{

StreamReader str1 = new StreamReader(textBox2.Text);

val1 = str1.ReadToEnd();

}

else if (radioButton2.Checked == true || radioButton4.Checked == true || radioButton3.Checked

== true || radioButton5.Checked == true || radioButton6.Checked == true)

{

byte[] fileArray = File.ReadAllBytes(textBox2.Text);

val1 = "";

for (int i = 0; i < fileArray.Length; i++)

{

if (fileArray[i] == 0)

{

val1 += "Ā";

}

else

{

val1 += (char)fileArray[i];

}

}

}

int ii = val1.Length;

time = DateTime.Now.TimeOfDay.ToString();

string kuy = textBox1.Text;

if (kuy.Length < 16)

{

MessageBox.Show("Key length should be greater than equal to 17 characters");

goto BB;

}

string key = kuy.Substring(0, 16);

string Text = val1; ;

while (Text.Length % 16 != 0)

{

Text += "Ā";

}

string Secret_Key = kuy.Substring(16);

if (Secret_Key.Length > 16)

{

MessageBox.Show("Secret Key Length Should be less then 32 characters");

}

else if (Secret_Key.Length == 0)

{

MessageBox.Show("Key length Should be minimum of 17 Character");

}

if (key.Length > 16)

{

MessageBox.Show("Key Length Exceed");

}

else if (kuy.Length < 16)

{

Page | 116

MessageBox.Show("Key Length should be minimum of 17 character ");

}

else

{

Int64 Sum = Calculate_Sum(Secret_Key);

int Random_Number = Calculate_Random_Number(Sum);

int Encryption_Number = Calculate_Encryption_Number(Sum);

int k = 0;

char[,] ky = new char[4, 4];

char[,] txt = new char[4, 4];

int avg = (Random_Number + Encryption_Number) / 2;

int u = 0;

string ss = "";

char[,] temp2 = new char[4, 8];

for (int t = 0; t < Text.Length; t = t + 16)

{

k = 0;

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

{

for (int j = 0; j < 4; j++)

{

txt[i, j] = Text[u++];

ky[i, j] = key[k++];

}

}

for (int p = 0; p <= avg; p++)

{

//step 4

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

{

for (int j = 0; j < 4; j++)

{

if (j == 0)

{

char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

}

if (j == 2)

{

char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

}

}

}

char[,] temp = new char[8, 4];

char[,] temp1 = new char[8, 4];

//step 5

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

{

for (int j = 0; j < 4; j++)

Page | 117

{

if (i < 4)

{

temp[i, j] = ky[i, j];

}

else

{

temp[i, j] = txt[i - 4, j];

}

}

}

//step 6

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

{

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

{

if (j < 4)

{

temp1[j, i] = temp[7 - 2 * i, 3 - j];

}

else

{

temp1[j, i] = temp[6 - 2 * i, 3 - (j - 4)];

}

}

}

// step 7

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

{

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

{

if (i == 0)

{

char s = temp1[j, i];

temp1[j, i] = temp1[j, i + 1];

temp1[j, i + 1] = s;

}

if (i == 2)

{

char s = temp1[j, i];

temp1[j, i] = temp1[j, i + 1];

temp1[j, i + 1] = s;

}

}

}

// step 8

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

{

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

{

temp2[i, j] = temp1[j, i];

}

}

// step-9

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

Page | 118

{

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

{

if (i == 0)

{

char s = temp2[i, j];

temp2[i, j] = temp2[i + 3, j];

temp2[i + 3, j] = s;

}

if (i == 1)

{

char s = temp2[i, j];

temp2[i, j] = temp2[i + 1, j];

temp2[i + 1, j] = s;

}

}

}

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

{

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

{

if (j < 4)

{

ky[i, j] = temp2[i, j];

}

else

{

txt[i, j - 4] = temp2[i, j];

}

}

}

}

y = "";

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

{

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

{

y+= temp2[i, j];

}

}

ss += y;

}

string time1 = DateTime.Now.TimeOfDay.ToString();

richTextBox1.Text = ss;

string ss1 = textBox2.Text;

int le1 = ss1.LastIndexOf('.');

ss1 = ss1.Substring(0, le1);

ss1 = ss1 + "_2.pa";

MessageBox.Show("Encryption Completed");

//saveFileDialog1.ShowDialog();

StreamWriter stw = new StreamWriter(ss1);

Page | 119

stw.Write(ss);

stw.Close();

DateTimeFormatInfo dtfi = new DateTimeFormatInfo();

dtfi.ShortDatePattern = "dd-MM-yyyy";

dtfi.DateSeparator = "-";

DateTime t1 = Convert.ToDateTime(time, dtfi);

DateTime t2 = Convert.ToDateTime(time1, dtfi);

TimeSpan span = t2.Subtract(t1);

label8.Text = TimeSpan.Parse(time).Hours.ToString() + ":" +

TimeSpan.Parse(time).Minutes.ToString() + ":" + TimeSpan.Parse(time).Seconds.ToString() + ":" +

TimeSpan.Parse(time).Milliseconds.ToString();

label7.Text = TimeSpan.Parse(time1).Hours.ToString() + ":" +

TimeSpan.Parse(time1).Minutes.ToString() + ":" + TimeSpan.Parse(time1).Seconds.ToString() + ":" +

TimeSpan.Parse(time1).Milliseconds.ToString();

label6.Text = span.Hours.ToString() + ":" + span.Minutes.ToString() + ":" +

span.Seconds.ToString() + ":" + span.Milliseconds.ToString();

int fileSize = 0;

if (((ii) % 1024) == 0)

{

fileSize = (ii) / 1024;

}

else

{

fileSize = (ii) / 1024;

fileSize++;

}

string[] reslt = new string[] { "Encryption", fileSize.ToString(), label6.Text };

dataGridView1.Rows.Add(reslt);

if (radioButton1.Checked == true)

{

// Add to DataBase

#region DataBase Creation

int num = 0;

string sql = "select * from Tab";

SqlConnection cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

SqlDataReader dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

Page | 120

{

num = int.Parse(dread["SNo"].ToString());

}

num = num + 1;

}

else

{

num = 1;

}

cn.Close();

//Chk File

int flag = 0;

sql = "select * from Tab";

cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

if (dread["File_Size"].ToString() == fileSize.ToString())

{

if (dread["Type"].ToString() == "Encryption")

{

flag = 1;

break;

}

}

}

}

cn.Close();

if (flag == 0)

{

sql = "insert into Tab values(" + num + ",'" + fileSize.ToString() + "','Encryption',0,'" +

label6.Text + "',0)";

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

else

{

sql = "update Tab set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

ConnectionClass obj = null;

obj = new ConnectionClass();

Page | 121

obj.ExecuteMyQuery(sql);

}

#endregion

}

else if (radioButton2.Checked == true || radioButton3.Checked == true || radioButton4.Checked

== true || radioButton5.Checked == true || radioButton6.Checked == true)

{

// Add to DataBase

#region DataBase Creation

int num = 0;

string sql ="";

#region SQL

if (radioButton2.Checked == true)

{

sql = "select * from Tab_PDF";

}

if (radioButton3.Checked == true)

{

sql = "select * from Tab_Word";

}

if (radioButton4.Checked == true)

{

sql = "select * from Image";

}

if (radioButton5.Checked == true)

{

sql = "select * from Tab_Excel";

}

if (radioButton6.Checked == true)

{

sql = "select * from Tab_MP3";

}

#endregion

SqlConnection cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

SqlDataReader dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

num = int.Parse(dread["SNo"].ToString());

}

num = num + 1;

}

else

{

num = 1;

Page | 122

}

cn.Close();

//Chk File

int flag = 0;

#region SQL

if (radioButton2.Checked == true)

{

sql = "select * from Tab_PDF";

}

if (radioButton3.Checked == true)

{

sql = "select * from Tab_Word";

}

if (radioButton4.Checked == true)

{

sql = "select * from Image";

}

if (radioButton5.Checked == true)

{

sql = "select * from Tab_Excel";

}

if (radioButton6.Checked == true)

{

sql = "select * from Tab_MP3";

}

#endregion

cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

if (dread["File_Size"].ToString() == fileSize.ToString())

{

if (dread["Type"].ToString() == "Encryption")

{

flag = 1;

break;

}

}

}

}

cn.Close();

if (flag == 0)

{

Page | 123

#region SQL

if (radioButton2.Checked == true)

{

sql = "insert into Tab_PDF values(" + num + ",'" + fileSize.ToString() +

"','Encryption',0,'" + label6.Text + "',0)";

}

if (radioButton3.Checked == true)

{

sql = "insert into Tab_Word values(" + num + ",'" + fileSize.ToString() +

"','Encryption',0,'" + label6.Text + "',0)";

}

if (radioButton4.Checked == true)

{

sql = "insert into Image values(" + num + ",'" + fileSize.ToString() + "','Encryption',0,'"

+ label6.Text + "',0)";

}

if (radioButton5.Checked == true)

{

sql = "insert into Tab_Excel values(" + num + ",'" + fileSize.ToString() +

"','Encryption','0','" + label6.Text + "','0')";

}

if (radioButton6.Checked == true)

{

sql = "insert into Tab_MP3 values(" + num + ",'" + fileSize.ToString() +

"','Encryption',0,'" + label6.Text + "',0)";

}

#endregion

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

else

{

#region SQL

if (radioButton2.Checked == true)

{

sql = "update Tab_PDF set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

}

if (radioButton3.Checked == true)

{

sql = "update Tab_Word set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

}

if (radioButton4.Checked == true)

{

sql = "update Image set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

Page | 124

}

if (radioButton5.Checked == true)

{

sql = "update Tab_Excel set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

}

if (radioButton6.Checked == true)

{

sql = "update Tab_MP3 set Proposed_Algo='" + label6.Text + "' where File_Size= '" +

fileSize.ToString() + "' and Type= 'Encryption'";

}

#endregion

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

#endregion

}

}

BB:

y = "";

#endregion Encryption

}

private void button3_Click(object sender, EventArgs e)

{

#region Decryption

string time = "";

string yy = "";

time = DateTime.Now.TimeOfDay.ToString();

StreamReader str1 = new StreamReader(textBox2.Text);

string val1 = str1.ReadToEnd();

int ii = val1.Length;

string kuy = textBox1.Text;

if (kuy.Length < 16)

{

MessageBox.Show("Key length should be greater than equal to 17 characters");

goto BB;

}

string key = kuy.Substring(0, 16);

string Text = val1;

while (Text.Length % 32 != 0)

{

Text += "Ā";

}

string Secret_Key = kuy.Substring(16);

if (Secret_Key.Length > 16)

{

MessageBox.Show("Secret Key Length Should be less then equal to 32 characters");

}

else if (Secret_Key.Length == 0)

{

MessageBox.Show("Minimum key length should be of 17 Characters");

Page | 125

}

if (key.Length > 16)

{

MessageBox.Show("Key Length Exceed");

}

else if (kuy.Length < 16)

{

MessageBox.Show("Key Length should be greater than equal to 17 characters ");

}

else

{

Int64 Sum = Calculate_Sum(Secret_Key);

int Random_Number = Calculate_Random_Number(Sum);

int Encryption_Number = Calculate_Encryption_Number(Sum);

int k = 0;

char[,] ky = new char[4, 4];

char[,] txt = new char[4, 4];

int avg = (Random_Number + Encryption_Number) / 2;

int u = 0;

string ss = "";

string kk = "";

char[,] temp2 = new char[4, 8];

for (int t = 0; t < Text.Length; t = t + 32)

{

k = 0;

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

{

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

{

temp2[i, j] = Text[u++];

}

}

for (int p = 0; p <= avg; p++)

{

//Step 9

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

{

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

{

if (i == 0)

{

char s = temp2[i, j];

temp2[i, j] = temp2[i + 3, j];

temp2[i + 3, j] = s;

}

if (i == 1)

{

char s = temp2[i, j];

temp2[i, j] = temp2[i + 1, j];

temp2[i + 1, j] = s;

} } }

//step-8

char[,] temp1 = new char[8, 4];

Page | 126

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

{

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

{

temp1[j, i] = temp2[i, j];

}

}

//Step 7

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

{

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

{

if (i == 0)

{

char s = temp1[j, i];

temp1[j, i] = temp1[j, i + 1];

temp1[j, i + 1] = s;

}

if (i == 2)

{

char s = temp1[j, i];

temp1[j, i] = temp1[j, i + 1];

temp1[j, i + 1] = s;

}

}

}

//Step -6

char[,] temp = new char[8, 4];

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

{

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

{

if (j < 4)

{

temp[7 - 2 * i, 3 - j] = temp1[j, i];

}

else

{

temp[6 - 2 * i, 3 - (j - 4)] = temp1[j, i];

}

}

}

// step-5

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

{

for (int j = 0; j < 4; j++)

{

if (i < 4)

{

ky[i, j] = temp[i, j];

}

else

{

Page | 127

txt[i - 4, j] = temp[i, j];

}

}

}

//step 4

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

{

for (int j = 0; j < 4; j++)

{

if (j == 0)

{

char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

}

if (j == 2)

{

char s = ky[i, j];

ky[i, j] = txt[i, j + 1];

txt[i, j + 1] = s;

}

}

}

// making ready for next round

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

{

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

{

if (j < 4)

{

temp2[i, j] = ky[i, j];

}

else

{

temp2[i, j] = txt[i, j - 4];

} } } }

yy = "";

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

{

for (int j = 0; j < 4; j++)

{

yy += txt[i, j]; } }

ss += yy;

kk = "";

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

{

for (int j = 0; j < 4; j++)

{

kk += ky[i, j]; } } }

while (ss[ss.Length - 1].ToString() == "Ā")

{

ss = ss.Substring(0, ss.Length - 1);

}

if (kk == key)

Page | 128

{

string time1 = DateTime.Now.TimeOfDay.ToString();

richTextBox2.Text = ss;

string ss1 = textBox2.Text;

int le1 = ss1.LastIndexOf('.');

ss1 = ss1.Substring(0, le1);

if (radioButton1.Checked == true)

{

ss1 = ss1 + "_2.txt";

//saveFileDialog1.ShowDialog();

StreamWriter stw = new StreamWriter(ss1);

stw.Write(ss);

stw.Close();

}

else if (radioButton2.Checked == true || radioButton4.Checked == true ||

radioButton3.Checked == true || radioButton5.Checked == true || radioButton6.Checked == true)

{

#region SAVE

if (radioButton2.Checked == true)

ss1 = ss1 + "_2.pdf";

if (radioButton4.Checked == true)

ss1 = ss1 + "_2.jpg";

if (radioButton3.Checked == true)

ss1 = ss1 + "_2.DOCX";

if (radioButton5.Checked == true)

ss1 = ss1 + "_2.xlsx";

if (radioButton6.Checked == true)

ss1 = ss1 + "_2.mp3";

//saveFileDialog1.ShowDialog();

byte[] array = new byte[ss.Length];

for (int ure = 0; ure < ss.Length; ure++)

{

if (ss[ure] == 'Ā')

{

array[ure] = 0;

}

else

{

array[ure] = (byte)ss[ure];

File.WriteAllBytes(ss1, array);

}

}

#endregion

}

MessageBox.Show("Decryption Completed");

DateTimeFormatInfo dtfi = new DateTimeFormatInfo();

dtfi.ShortDatePattern = "dd-MM-yyyy";

dtfi.DateSeparator = "-";

DateTime t1 = Convert.ToDateTime(time, dtfi);

DateTime t2 = Convert.ToDateTime(time1, dtfi);

Page | 129

TimeSpan span = t2.Subtract(t1);

label11.Text = TimeSpan.Parse(time).Hours.ToString() + ":" +

TimeSpan.Parse(time).Minutes.ToString() + ":" + TimeSpan.Parse(time).Seconds.ToString() + ":" +

TimeSpan.Parse(time).Milliseconds.ToString();

label10.Text = TimeSpan.Parse(time1).Hours.ToString() + ":" +

TimeSpan.Parse(time1).Minutes.ToString() + ":" + TimeSpan.Parse(time1).Seconds.ToString() + ":" +

TimeSpan.Parse(time1).Milliseconds.ToString();

label9.Text = span.Hours.ToString() + ":" + span.Minutes.ToString() + ":" +

span.Seconds.ToString() + ":" + span.Milliseconds.ToString();

//int fileSize = 0;

//if (((ii) % 1024) == 0)

//{

// fileSize = (ii) / 1024;

//}

//else

//{

// fileSize = (ii) / 1024;

// fileSize++;

//}

int iii = ss.Length;

int fileSize1 = 0;

if (((iii) % 1024) == 0)

{

fileSize1 = (iii) / 1024;

}

else

{

fileSize1 = (iii) / 1024;

fileSize1++;

}

string[] reslt = new string[] { "Decryption", fileSize1.ToString(), label9.Text };

dataGridView1.Rows.Add(reslt);

if (radioButton1.Checked == true)

{

#region DataBase Creation

int num = 0;

string sql = "select * from Tab";

SqlConnection cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

SqlDataReader dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

Page | 130

num = int.Parse(dread["SNo"].ToString());

}

num = num + 1;

}

else

{

num = 1;

}

cn.Close();

//Chk File

int flag = 0;

sql = "select * from Tab";

cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

if (dread["File_Size"].ToString() == fileSize1.ToString())

{

if (dread["Type"].ToString() == "Decryption")

{

flag = 1;

break;

}

}

}

}

cn.Close();

if (flag == 0)

{

sql = "insert into Tab values(" + num + ",'" + fileSize1.ToString() + "','Decryption',0,'"

+ label9.Text + "',0)";

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

else

{

sql = "update Tab set Proposed_Algo='" + label9.Text + "' where File_Size= '" +

fileSize1.ToString() + "' and Type= 'Decryption'";

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

Page | 131

}

#endregion

}

else if (radioButton2.Checked == true || radioButton3.Checked == true ||

radioButton4.Checked == true || radioButton5.Checked == true || radioButton6.Checked == true)

{

// Add to DataBase

#region DataBase Creation

int num = 0;

string sql = "";

#region SQL

if (radioButton2.Checked == true)

{

sql = "select * from Tab_PDF";

}

if (radioButton3.Checked == true)

{

sql = "select * from Tab_Word";

}

if (radioButton4.Checked == true)

{

sql = "select * from Image";

}

if (radioButton5.Checked == true)

{

sql = "select * from Tab_Excel";

}

if (radioButton6.Checked == true)

{

sql = "select * from Tab_MP3";

}

#endregion

SqlConnection cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

SqlDataReader dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

num = int.Parse(dread["SNo"].ToString());

}

num = num + 1;

}

else

{

num = 1;

Page | 132

}

cn.Close();

//Chk File

int flag = 0;

#region SQL

if (radioButton2.Checked == true)

{

sql = "select * from Tab_PDF";

}

if (radioButton3.Checked == true)

{

sql = "select * from Tab_Word";

}

if (radioButton4.Checked == true)

{

sql = "select * from Image";

}

if (radioButton5.Checked == true)

{

sql = "select * from Tab_Excel";

}

if (radioButton6.Checked == true)

{

sql = "select * from Tab_MP3";

}

#endregion

cn = null;

cn = new SqlConnection();

cn.ConnectionString = "Data

Source=.\\SQLEXPRESS;AttachDbFilename=D:\\AEDNCA\\WindowsFormsApplication1\\WindowsFo

rmsApplication1\\Database1.mdf;Integrated Security=True;User Instance=True";

cn.Open();

cmd = new SqlCommand();

cmd.Connection = cn;

cmd.CommandText = sql;

dread = cmd.ExecuteReader();

if (dread.HasRows)

{

while (dread.Read())

{

if (dread["File_Size"].ToString() == fileSize1.ToString())

{

if (dread["Type"].ToString() == "Decryption")

{

flag = 1;

break;

}

}

}

}

cn.Close();

if (flag == 0)

{

#region SQL

Page | 133

if (radioButton2.Checked == true)

{

sql = "insert into Tab_PDF values(" + num + ",'" + fileSize1.ToString() +

"','Decryption',0,'" + label9.Text + "',0)";

}

if (radioButton3.Checked == true)

{

sql = "insert into Tab_Word values(" + num + ",'" + fileSize1.ToString() +

"','Decryption',0,'" + label9.Text + "',0)";

}

if (radioButton4.Checked == true)

{

sql = "insert into Image values(" + num + ",'" + fileSize1.ToString() +

"','Decryption',0,'" + label9.Text + "',0)";

}

if (radioButton5.Checked == true)

{

sql = "insert into Tab_Excel values(" + num + ",'" + fileSize1.ToString() +

"','Decryption',0,'" + label9.Text + "',0)";

}

if (radioButton6.Checked == true)

{

sql = "insert into Tab_MP3 values(" + num + ",'" + fileSize1.ToString() +

"','Decryption',0,'" + label9.Text + "',0)";

}

#endregion

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

else

{

#region SQL

if (radioButton2.Checked == true)

{

sql = "update Tab_PDF set Proposed_Algo='" + label9.Text + "' where File_Size= '"

+ fileSize1.ToString() + "' and Type= 'Decryption'";

}

if (radioButton3.Checked == true)

{

sql = "update Tab_Word set Proposed_Algo='" + label9.Text + "' where File_Size= '"

+ fileSize1.ToString() + "' and Type= 'Decryption'";

}

if (radioButton4.Checked == true)

{

sql = "update Image set Proposed_Algo='" + label9.Text + "' where File_Size= '" +

fileSize1.ToString() + "' and Type= 'Decryption'";

Page | 134

}

if (radioButton5.Checked == true)

{

sql = "update Tab_Excel set Proposed_Algo='" + label9.Text + "' where File_Size= '"

+ fileSize1.ToString() + "' and Type= 'Decryption'";

}

if (radioButton6.Checked == true)

{

sql = "update Tab_MP3 set Proposed_Algo='" + label9.Text + "' where File_Size= '"

+ fileSize1.ToString() + "' and Type= 'Decryption'";

}

#endregion

ConnectionClass obj = null;

obj = new ConnectionClass();

obj.ExecuteMyQuery(sql);

}

#endregion

}

}

else

{

MessageBox.Show("Wrong Key");

}

}

BB:

yy = "";

#endregion

}

private void Form3_Load(object sender, EventArgs e)

{

this.dataGridView1.DefaultCellStyle.ForeColor = Color.Blue;

dataGridView1.Columns.Add("Algorithm", "Algorithm");

dataGridView1.Columns.Add("File_Size", "File Size");

dataGridView1.Columns.Add("Total_Time", "Total Time");

radioButton1.Checked = true;

}

private void button1_Click_1(object sender, EventArgs e)

{

Form6 t = new Form6();

t.Show();

this.Hide();

}

}

}