28.04.2014 Views

Encryption and Decryption Algorithm using 2-D Matrices - IJARCSSE

Encryption and Decryption Algorithm using 2-D Matrices - IJARCSSE

Encryption and Decryption Algorithm using 2-D Matrices - IJARCSSE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Volume 3, Issue 4, April 2013<br />

ISSN: 2277 128X<br />

International Journal of Advanced Research in<br />

Computer Science <strong>and</strong> Software Engineering<br />

Research Paper<br />

Available online at: www.ijarcsse.com<br />

<strong>Encryption</strong> <strong>and</strong> <strong>Decryption</strong> <strong>Algorithm</strong> <strong>using</strong> 2-D <strong>Matrices</strong><br />

BALAJEE MARAM 1 ,<br />

1 Asst. Prof., Dept. of Information<br />

Technology, GMRIT, RAJAM-<br />

532127, India.<br />

K LAKSHMANA RAO 2 ,<br />

2 Asst. Prof., Dept. of Information<br />

Technology, GMRIT, RAJAM-<br />

532127, India.<br />

Y RAMESH KUMAR 3<br />

3 Asso. Prof., Dept. Of IT, Avanthi<br />

Inst. Of Technology,<br />

Vizianagaram, AP, INDIA.<br />

Abstract- Data Security is plays a vital role in Data Communication through Internet. Definitely there is a need to protect<br />

the data from unauthorized access. Data may exist in many forms like images, tables, Icons, Text, Video, Audio, Colours<br />

etc. Till now many methods or algorithms have been proposed in the world. Any way Cryptography plays an important<br />

role to encode <strong>and</strong> decode the Information. This paper also proposes a new method for encode <strong>and</strong> decode the data by<br />

<strong>using</strong> Shared-Secret-Key, Session-Key <strong>and</strong> Intermediate-Key <strong>and</strong> Matrix operations.<br />

Keywords - <strong>Matrices</strong>, Matrix Operation, Encoder, Decoder, Message Matrix.<br />

I.INTRODUCTION<br />

Cryptography is a technique which allow human-being to encrypt the data in such a way that the decryption can be performed<br />

without the aid of sender. As the network technology has been greatly advanced, there is a need to send much information via<br />

the Internet. At the same time, the security issues are a crucial problem in the transmission process.<br />

In this process, one shared-secret-key has been shared by the sender & receiver. When there is a need to send a message, onetime<br />

session-key will have been generated. Then all the characters will be shuffled based on mathematical techniques. Now<br />

all the characters will be arranged in different matrices. Again all the characters in all the matrices will be shuffled. Now the<br />

data will be encrypted <strong>using</strong> one-time session-key. Then the encrypted message <strong>and</strong> Intermediate-key will be transmitted to<br />

the Destination. When the cipher-text reaches the Destination, the session-key will be computed by <strong>using</strong> both one-time<br />

session-key <strong>and</strong> shared-secret-key. Then the message will be decrypted. The detailed explanation will come in next chapters.<br />

II. EXISTING SYSTEMS<br />

A. HILL CIPHER method for Blocks<br />

Though Hill cipher's or linear block cipher is susceptible to cryptanalysis <strong>and</strong> unusable in practice, still serves an<br />

important pedagogical role in both cryptology <strong>and</strong> linear algebra. It is this role in linear algebra that raises several interesting<br />

questions [1]. In general, the key space of the Hill cipher is precisely GL(r, Zm) the group of r * r matrices that are invertible<br />

over Zm for a predetermined modulus m. We first present a formula for the order of this group. We then consider involuntary<br />

matrices, which eliminate the necessity of computing matrix inverses for Hill decryptions. Finally, we compare the total<br />

number of matrices with the number of invertible <strong>and</strong> involuntary matrices, identifying the effects of change in dimension<br />

<strong>and</strong> modulus on the order of the key space [1]. It is fundamentally equivalent <strong>and</strong> is consistent with modern texts in<br />

cryptography. A plaintext string over an alphabet of order m is rewritten as a vector over Zm <strong>using</strong> a natural correspondence.<br />

In either column major or row-major order, the vector is rewritten as a matrix P with d rows, where d is an arbitrarily chosen<br />

positive integer [1].<br />

For a fixed n ϵ IN, the key space K is the set of all invertible n x n matrices in ZZ nxn 26 .P = C = ZZ n 26. Messages m ϵ<br />

ZZ* that are longer than n are split into blocks of length n <strong>and</strong> are encrypted block-wise. All arithmetic operations are<br />

carried out modulo 26[1]. The Hill cipher is defined as follows:<br />

For each K ϵ K, define the encryption function<br />

EK : ZZ n 26 -> ZZ n 26 by[1]<br />

EK (p) = K . p mod 26 ……(1)<br />

Where “.” denotes matrix multiplication modulo 26[1].<br />

Letting K -1 denote the inverse matrix of K, the decryption function DK-1: ZZ n 26 -> ZZ n 26 is defined by<br />

DK-1(c) = K -1 . c mod 26[1] ………...(2)<br />

Since K-1 can easily be computed from K, the Hill cipher is a symmetric cryptosystem. It is also the most general linear<br />

block cipher. Affine linear block ciphers are easy to break by known-plain-text attacks. That is, for an attacker who knows<br />

some sample plain texts with the corresponding encryptions, it is not too hard to find the key used to encrypt these plain texts<br />

[1].<br />

© 2013, <strong>IJARCSSE</strong> All Rights Reserved Page | 352


Maram et al., International Journal of Advanced Research in Computer Science <strong>and</strong> Software Engineering 3(4),<br />

April - 2013, pp. 352-356<br />

B. HILL CIPHER for Visual Cryptography<br />

Hill cipher, developed by the mathematician Lester Hill in 1929, lies in the manipulation of matrix. For encryption,<br />

algorithm takes m successive plain text letters <strong>and</strong> substitutes m cipher letters. In Hill cipher, each character is assigned a<br />

numerical value like α=0, β=1 …… ζ=25[3]. The substitution of cipher text letters leads to „m‟ linear equation. This can be<br />

expressed ασX=KП, ωηερε C <strong>and</strong> P are column vectors, representing the plain text <strong>and</strong> cipher text respectively, <strong>and</strong> K is<br />

the encryption key matrix. All these operations are performed with modulo 26. <strong>Decryption</strong> requires <strong>using</strong> the inverse of the<br />

matrix K. The inverse matrix K -1 of a matrix K is defined by the equation KK -1 =k -1 K=I , where I is the Identity matrix. But<br />

the inverse of the matrix does not always exist, <strong>and</strong> when it does, it satisfies the preceding equation. is K -1 applied to the<br />

cipher text, <strong>and</strong> then the plaintext is recovered. In general term, this is written as follows:<br />

For encryption:<br />

C=E K (P)=K P<br />

For <strong>Decryption</strong>:<br />

P=D K (C)=K -1 C=K -1 K P =P<br />

C. The Double-Reflecting Data Perturbation Method<br />

The Double-Reflecting Data Perturbation Method [4] denoted by DRDP reverberates the original data by x-axis <strong>and</strong><br />

y-axis to achieve the perturbed data for some confidential attribute. In this method, the r<strong>and</strong>omization function plays a very<br />

crucial rule, <strong>and</strong> if the function is not properly chosen it May degrade the clustering quality. The distortion operation<br />

performed to the confidential attribute is given by<br />

op j =ρ Aj + (ρ Aj – aj ) = 2 ρ Aj – aj.<br />

Where Aj (1 ≤ j≤ n) is a confidential attribute <strong>and</strong> a j (1 ≤ j ≤ n) is an instance of Aj. ρ Αj is defined by the following formula<br />

ρ Aj<br />

=|(max Aj + min Aj)/2|<br />

Where max Aj <strong>and</strong> min Aj are respectively the maximum value <strong>and</strong> minimum value of attribute Aj. The „student‟ relational<br />

database before <strong>and</strong> after applying DRDP is shown in the following Table:<br />

S.No RollNo Name Marks Distored Marks<br />

1 101 Raj 78 92<br />

2 102 Ravi 89 81<br />

3 103 Rohan 92 78<br />

4 104 Rani 82 88<br />

5 105 Rahul 80 90<br />

III. PROPOSED SYSTEMS<br />

A. <strong>Algorithm</strong> for <strong>Encryption</strong><br />

Steps:<br />

1) There is a need to share one secret-key is called “Shared-Secret-Key”. This is permanent key between the Sender<br />

<strong>and</strong> Receiver. Its length is 16-byte.<br />

2) A one-time key has been generated is called “Session-Key”. This is temporary key is valid for specific session only.<br />

Its length is 16-byte.<br />

3) Now an Intermediate-Key will be generated based on both Shared-Secret-Key <strong>and</strong> Session-Key in the following<br />

way:<br />

sk 11 sk 12 sk 13 sk 14<br />

sk 21 sk 22 sk 23 sk 24<br />

sk 31 sk 32 sk 33 sk 34<br />

sk 41 sk 42 sk 43 sk 44<br />

is XORed with<br />

s 11 s 12 s 13 s 14 i 11 i 12 i 13 i 14<br />

s 21 s 22 s 23 s 24 = i 21 i 22 i 23 i 24<br />

s 31 s 32 s 33 s 34 i 31 i 32 i 33 i 34<br />

s 41 s 42 s 43 s 44<br />

i 41 i 42 i 43 i 44<br />

© 2013, <strong>IJARCSSE</strong> All Rights Reserved Page | 353


Maram et al., International Journal of Advanced Research in Computer Science <strong>and</strong> Software Engineering 3(4),<br />

April - 2013, pp. 352-356<br />

Here t 11 =sk 11 XOR s 11 , t 12 =sk 12 XOR s 12 ….. so on.<br />

. Its length is also 16-byte only. Here sk st<strong>and</strong>s for Shared-Secret-Key, s st<strong>and</strong>s for Session-Key <strong>and</strong> i st<strong>and</strong>s for<br />

Intermediate-Key.<br />

4) All the characters in each sentence will be shuffled according to Double-reflecting Data-Perturbation method. Here<br />

Delimiter is „. (dot)‟.<br />

5) All characters will arranged in 4X4 matrices (except last characters i.e. Total Number of Characters % 16).<br />

6) All matrices will be transposed.<br />

7) All 4 characters in each row in every matrix will be shuffled according to Double-reflecting-data-perturbation<br />

method.<br />

8) Now the characters in 1 st row, 2 nd row, 3 rd row <strong>and</strong> 4 th row in 1 st matrix will be arranged as a paragraph. Then from<br />

2 nd matrix <strong>and</strong> so on.<br />

9) The first 16 characters are XORed with one-time Session-Key.<br />

10) Next 16 characters are XORed by Intermediate-Key, <strong>and</strong> so on.<br />

11) Now the Intermediate-Key is appended to cipher-text <strong>and</strong> transmitted to the destination<br />

B. <strong>Algorithm</strong> for <strong>Decryption</strong><br />

Steps:<br />

1) After receiving the cipher-text, the receiver simply extract last 16 characters, is nothing but Intermediate key.<br />

2) The receiver calculates the Session-Key <strong>using</strong> Intermediate-Key <strong>and</strong> Shared-Secret-Key in the following way:<br />

s 11 =sk 11 XOR i 11, s 12 =sk 12 XOR i 12, …….. So on.<br />

3) The first 16 characters are XORed with one-time Session-Key.<br />

4) Next 16 characters are XORed by Intermediate-Key, <strong>and</strong> so on.<br />

5) All characters will arranged in 4X4 matrices (except last characters i.e. Total Number of Characters % 16).<br />

6) All 4 characters in each row in every matrix will be reshuffled according to Double-reflecting-data-perturbation<br />

method.<br />

7) All matrices will be transposed.<br />

8) Now all the characters in each row in each matrix including left-over characters are arranged as a paragraph.<br />

9) All the characters in each row (dot is delimiter for each row) will be reshuffled according to Double-reflecting-Data-<br />

Perturbation method.<br />

10) Then the original text will have been generated.<br />

11)<br />

IV.ILLUSTRATION<br />

A. ENCRYPTION<br />

1) Shared-Secret-Key:3Venee is G00d..<br />

2) One-time Session-Key:Nature Kals me..<br />

3) Intermediate-Key:}7&quot;L4]<br />

4) Input Text: My name is BALAJEE MARAM. I am working as an Assistant Professor in GMRIT. It is well<br />

known engineering college in Coastal Andhra.<br />

5) Total No. of Characters: 130<br />

6) Decimal format of the Input Text: 77 121 32 110 97 109 101 32 105 115 32 66 65 76 65 74 69 69 32 77 65 82<br />

65 77 46 32 73 32 97 109 32 119 111 114 107 105 110 103 32 97 115 32 97 110 32 65 115 115 105 115 116 97<br />

110 116 32 80 114 111 102 101 115 115 111 114 32 105 110 32 71 77 82 73 84 46 32 73 116 32 105 115 32<br />

119 101 108 108 32 107 110 111 119 110 32 101 110 103 105 110 101 101 114 105 110 103 32 99 111 108 108<br />

101 103 101 32 105 110 32 67 111 97 115 116 97 108 32 65 110 100 104 114 97 46<br />

7) Now all the characters (Except.) in each sentence have been shuffled according to Double reflecting data<br />

perturbation method.<br />

8) After shuffling the characters in the first sentence is like the following:<br />

L y+8,4Y0&yWXMXOTTyLXGXL. In this way, all the characters in each sentence will be shuffled according to<br />

Double reflecting data perturbation method.<br />

9) All characters will arranged in 4X4 matrices (except last characters i.e. Total Number of Characters % 16).<br />

10) All matrices will be transposed.<br />

11) All 4 characters in each row in every matrix will be shuffled according to Double-reflecting-data-perturbation<br />

method.<br />

12) Now the characters in 1 st row, 2 nd row, 3 rd row <strong>and</strong> 4 th row in 1 st matrix will be arranged as a paragraph. Then<br />

from 2 nd matrix <strong>and</strong> so on.<br />

13) Now the first 16 characters are “


Maram et al., International Journal of Advanced Research in Computer Science <strong>and</strong> Software Engineering 3(4),<br />

April - 2013, pp. 352-356<br />

B. DECRYPTION<br />

1) After receiving the cipher-text, the receiver extracts the last 16-bytes (Intermediate-Key)<br />

2) Now the receiver can calculate the Session-Key by <strong>using</strong> Shared-Secret-Key <strong>and</strong> Intermediate-Key.<br />

3) The first 16 characters are XORed with one-time Session-Key. So the first 16 characters are converted like<br />

the following: “r1,E?$gkU G u Ec{“.<br />

4) Next 16 characters are XORed by Intermediate-Key, <strong>and</strong> so on.<br />

5) All characters will arranged in 4X4 matrices (except last characters i.e. Total Number of Characters % 16).<br />

6) All 4 characters in each row in every matrix will be shuffled according to Double-reflecting-dataperturbation<br />

method.<br />

7) All matrices will be transposed.<br />

8) Now all the characters in each row in each matrix including left-over characters are arranged as a<br />

paragraph.<br />

9) All the characters in each row (dot is delimiter for each row) will be reshuffled according to Doublereflecting-Data-Perturbation<br />

method.<br />

V. ADVANTAGES IN PROPOSED SYSTEM<br />

1) For even sentences, the Session-Key is applicable <strong>and</strong> for odd sentences, the Intermediate-Key is applicable. So two<br />

consecutive sentences will be encrypted differently.<br />

2) No need to send both the keys i.e. Session-Key <strong>and</strong> Intermediate-Key.<br />

VI. SECURITY LEVEL<br />

In 1st phase of proposed method, all the characters in the sentence are converted into ASCII.<br />

Now those characters are shuffled according to their ASCII value based on Double Reflecting Data Perturbation Method. The<br />

privacy of data is measured by the variance between the actual <strong>and</strong> the perturbed values which is given by the following<br />

formula<br />

A = VAR (A−A′ )<br />

VAR (A)<br />

It has been analyzed that the privacy or the security level of the confidential data is improved a lot by the<br />

proposed method for <strong>Encryption</strong> <strong>and</strong> <strong>Decryption</strong>. The Security level of the Double Reflecting Data<br />

Perturbation Method for 1 st sentence “My name is BALAJEE MARAM” is shown the following chart.<br />

After observing this Chart, easily we can identify no similarities between Character (before shuffling) <strong>and</strong> Character (after<br />

shuffling). So it is a good significance in Cryptography.<br />

VII. CONCLUSION<br />

As of now, many algorithms <strong>and</strong> technologies have been proposed by many researchers in the world. But till today,<br />

it is very difficult to provide security to the information which is being passed through Internet. So this proposed paper tries<br />

© 2013, <strong>IJARCSSE</strong> All Rights Reserved Page | 355


Maram et al., International Journal of Advanced Research in Computer Science <strong>and</strong> Software Engineering 3(4),<br />

April - 2013, pp. 352-356<br />

to give one more new algorithm for Information Security. It is a Symmetric <strong>Encryption</strong> only. In near future, this will be<br />

extended to Public-Cloud.<br />

ACKNOWLEDGEMENT<br />

I am very thankful to all the authors <strong>and</strong> owners of websites which I mentioned in REFERENCES <strong>and</strong> BIBLIOGRAPHY<br />

section. Here I want to contribute <strong>and</strong> share my knowledge with rest of the world. Financially I am not expecting anything.<br />

So any Researcher want to use this content, please include that content which included in this paper. Thank you for Chief-<br />

Editor <strong>and</strong> Reviewers.<br />

If any Researcher wants to include this paper, please use the following citation:<br />

Balajee Maram, Lakshmana Rao K, Ramesh Kumar Y, 2013, “<strong>Encryption</strong> <strong>and</strong> <strong>Decryption</strong> <strong>Algorithm</strong> <strong>using</strong> 2-D<br />

<strong>Matrices</strong>”, International Journal of Advanced Research in Computer Science <strong>and</strong> Software Engineering (<strong>IJARCSSE</strong>),<br />

Vol 3- Issue 4, April-2013.<br />

REFERENCES<br />

[1] John C. Bowman, Math 422 Coding Theory & Cryptography, University of Alberta, Edmonton, Canada<br />

[2] http://aix1.uottawa.ca/~jkhoury/cryptography.htm<br />

[3] Stallings. W, “Cryptography <strong>and</strong> Network Security”, 4th edition, Prentice Hall, 2005<br />

[4] A. Viji Amutha Mary, Dr. T. Jebarajan, A Novel Data Perturbation Technique with higher Security, IJCET, Vol:3,<br />

Issue:2, pp:126-132,2012<br />

[5] http://aix1.uottawa.ca/~jkhoury/cryptography.htm)<br />

[6] Maram Balajee, Challa Narasimham, “Double-reflecting Data Perturbation Method for Information Security”, ISSN:<br />

0974-6471 December 2012, Vol. 5, No. (2):Pgs. 283-288<br />

© 2013, <strong>IJARCSSE</strong> All Rights Reserved Page | 356

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!