An integrated symmetric key cryptography algorithm using generalised modifiedvernam cipher method and djsa method: djmna symmetric key algorithm

Uploaded on


More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. An Integrated Symmetric key Cryptography Algorithm using Generalised modifiedVernam Cipher method and DJSA method: DJMNA symmetric key algorithmDebanjan Das1, Megholova Mukherjee2, NehaChoudhary3, Asoke Nath4Department of Computer ScienceSt.Xavier’s CollegeKolkata,,,,4asokejoy@gmail.comJoyshree NathA.K.Chaudhuri School of I.TRaja Bazar Science CollegeKolkata,Indiajoyshreenath@gmail.comAbstract— In the present work the authors have introducedan integrated symmetric key cryptographic method DJMNAwhich combine two independent methods (i) ModifiedGeneralized Vernam Cipher (MGVC) method and (ii) DJSAmethod which is an extension of MSA method. The GeneralizedVernam Cipher algorithm extends text encryption to any typeof data encryption. This is done by using ASCII code of allcharacters (0-255). This modified version of GeneralizedVernam Cipher uses “feedback” effect and also reverses the filewhile encryption. This makes the encryption process very hardto decrypt by using any brute force method. It was found thatthe encrypted text has huge difference for similar plaintextshaving minor difference even for the same text-key. From thistext key two randomized matrices are generated. The elementsof this matrix decides the order of application of DJSA andMGVC methodsKeywords-randomization,multiple encryption, VernamCipher, plain text, feedbackI. INTRODUCTIONThe network security and data encryption now-a-days isa very important issue in modern communication network.When we send some confidential matter from one client toanother client or from client to server then that data shouldnot be intercepted by intruder or hacker. It means wheneverwe want to send some message to someone that should beencrypted in such a way that no one can be able to decryptwithout knowing the key for the decryption process.Cryptography is now an emerging research area where thescientists are trying to develop some good encryptionalgorithm so that no intruder can intercept the encryptedmessage. In the present research work we have developed asymmetric key cryptography method. Symmetric keyalgorithms are well accepted in the modern communicationnetwork. The plus point of symmetric key cryptography isthat the key management is very simple one key is used forboth encryption as well as for decryption purpose. Thedisadvantage of symmetric key is that the key should be keptconfidential and should not be distributed to unauthorizedpersons. In the present work we have introduced a combinedsymmetric key cryptographic methods which consists of 2independent methods (i) Modified generalized Vernamcipher method(MGVCM) and (ii) DJSA method which is anextension of MSA method for encryption as well asdecryption of any file such as binary file, text file or anyother file. Nath et. al. [1] developed an algorithm calledMSA for encryption and decryption of any file using a 16x16random key matrix. But the weak point of MSA algorithm isthat if someone applies the brute force method then he has togive a trial for 256! to find the actual key matrix. Now in themodern world this number of trial runs may not beimpossible for the hacker. To solve this problem Nath et al[2] proposed a better method called DJSA algorithm. InDJSA the authors have considered the size of the key matrixto be 256X256 and in each cell we store 2 characters patterninstead of 1 character unlike MSA method. If someone wantsto give a brute force method to find our actual key then onehas to give a trial for 65536! runs. Theoretically this is anintractable problem. The key matrix contains all possible 2-lettered words (ASCII code 0-255). The total number ofwords possible is 65536. This key matrix is randomizedusing the method proposed by Nath [2]. The user has toenter some secret text-key. The maximum length of the textkey should be 16 characters. The number of randomizationand the number of encryption to be done is calculated fromthe text-key using a method proposed by Nath[1]. Theproblem in DJSA algorithm is that if we have same patternrepeated then the encrypted text may also repeat. Toeliminate this problem we have introduced modifiedgeneralized Vernam cipher encryption method. Theintegrated DJMNA method generates a separate key matrixof size 16x16 where in each cell we store a character seriallyfrom ASCII 0-255 in row major form. Then this matrix israndomized by a new algorithm proposed by the presentauthors. The algorithm for randomization is so designed thatthis matrix may have repetitions so total number of trial runsto break this key is in the order of 10616(≈256256).This keymatrix is not only used for encryption using MGVCM butalso decides order of applying MGVCM and DJSAencryption methods. This key matrix is re-randomized ateach new stage of multiple encryption and also in each blockof text while performing MGVCM. Each new key matrixwill also require 10616no. of trial runs to be broken. Thismethod will be suitable in any business house, governmentsectors, communication network, defense network system,
  • 2. sensor networks for encryption of a small file. To encrypt alarge file such as one of size 2MB or more, it will take moretime to encrypt as well as to decrypt some file. For large fileone can choose some key in such a way that number ofencryption will be less (say <=3) then encryption anddecryption can be done in reasonable time.This method may be applied in areas of secure datatransfer where the size of data to be transferred is not verylarge. Such data transfers are prevalent in the field of onlinefund transfer, short message service (SMS), instantmessenger (IM).II. DJMNA ALGORITHMA. Algorithm of randomize () Function:Step-1: StartStep-2: Copy text_key entered by user in 1stcolumn ofA[16][1]Step-3: Copy text_key entered by user in 1strow ofB[1][16]Step-4: Copy first 8 characters of text_key in 1stcolumnof C[8][1]Step-5: Copy next 8 characters of text_key in 1strow ofD[1][8]Step-6: Multiply Matrix C[8][1] by B[1][16] and store inE[8][16]Step-7: Multiply Matrix A[16][1] by D[1][8] and store inF[16][8]Step-8: Multiply Matrix F[16][8] by E[8][16] and store inG[16][16]Step-9: Add Matrix matr[16][16] and G[16][16] and storein matr[16][16]Step-10: Perform mod(matr[][],256) and store the resultin matr[][].Step-11: EndB. Encryption AlgorithmStep-1: StartStep-2: copy plaintext file name as pf[]Step-3: copy encrypted file name in ef[]Step-4: copy the content of pf[] file into a file sec_a.dat.Step-5: call function keygen() to calculate times(=randomization number)Step-5a: Store (0-255) in matr[16][16]Step-6: set i=1Step-7: Call function randomize() to create randomizematrix matr[16][16]Step-8: Copy all elements of matr[16][16] to key[256]Step-9: if mod(key[i],2) ≠ 0 and n1 ≠ then goto step-24Step-10: open file sec_a.dat in read modeStep-11: open file sec_b.dat in write modeStep-12: Read a block (Number of characters <=256)from file sec_a.datStep-13: set num=number of characters present in theblockStep-14: copy all characters from the block tostream[num]Step-15: If num<256 goto Step-23Step-16: call function encryptit(stream,num)Step-17: Call function randomize() to re-randomizeprevious randomize matrix matr[16][16]Step-18: Copy all elements of matr[16][16] to key[256]Step-19: Read next block (Number of characters <=256)from file sec_a.datStep-20: copy all characters from the block tostream[256]Step-21: set num=number of characters present in theblockStep-22: if num=256 then goto step-16Step-23: Call function encryptit(stream,num)Step-24: Call encryption("sec_a.dat","sec_b.dat")Step-25: Close file sec_a.datStep-26: Close file sec_b.datStep-27: Delete file sec_a.datStep-28: Rename file sec_b.dat as sec_a.datStep-29: If i<times then goto step-7 and if i=timesreverse file sec_a.dat and goto step-7Step-30: Delete file ef[].Step-31: Rename "sec_a.dat" to the name stored in ef[].Step-32: EndC. Algorithm of encryptit() function:Parameters: stream[],lStep-0: StartStep-1: Set ch3=0Step-2: Set i=0;Step-3: Set ch1=stream[i]Step-3: Set ch2=key[i]Step-4: Set ch3=mod((ch1+ch2+ch3),256)Step-5: Write the character ch3 in file sec_b.datStep-6: If i<l then goto step-3Step-7: EndD. Decryption AlgorithmStep-1: StartStep-2: copy encrypted file name in ef[]Step-3: copy decrypted file name in df[]Step-4: Calculate sizeof(ef[]) and store in nbytes.Step-5: copy content of file ef[] into sec_c.datStep-6: calculate ver_ran=int(nbytes/256)+1Step-7: Call function keygen() to calculatetimes(=randomization number)Step-8: Set i=1Step-9: Store (0-255) in matr[16][16]
  • 3. Step-10:Set j=1Step-11:Call function randomize() to create randomizematrix matr[16][16]Step-12: Copy all elements of matr[16][16] to key[256]Step-13: if mod(key[j],2)=0 then call randomize()(ver_ran-1) timesStep-14: if j<=times-n1 then goto step-9Step-15: Call function randomize() to get finalrandomized matrix matr[16[16]Step-16: Copy all elements of matr[16][16] to key[256]Step-17: if mod(key[times-n1+1],2) ≠0 and i≠1 then gotostep-30Step-18: Open file sec_dat in read modeStep-19: Open file sec_d.dat in writ modeStep-20: Read a block (Number of characters <=256)from file sec_c.datStep-21: set num=number of characters present in theblockStep-22: copy all characters from the block tostream[num]Step-23: If num<256 then goto step-29Step-24: Call function decryptit(stream,num)Step-25: Read a block (Number of characters <=256)from file sec_c.datStep-26: set num=number of characters present in theblockStep-27: copy all characters from the block tostream[num]Step-28: If num=256 then goto step-24Step-29: Call function decryptit(stream,num)Step-30:Call function decryption(sec_c.dat,sec_d.dat)Step-31:If i<=times then goto step-9 and if i=1 thenreverse file sec_c.dat and goto step-9Step-32:Delete file with filename df[]Step-33:Rename file sec_c.dat as that stored in df[]Step-34:EndE. Algorithm of decryptit() function:Parameters : char str[],int lStep-1:StartStep-2:ch4=0Step-3:Set i=0Step-4:Set ch1=str[i]Step-5:Set ch2=key[i]Step-6:Set ch3=mod((ch1+256-ch2-ch4),256)Step-7:Write character stored in ch3 into file sec_d.datStep-8:Set ch4=ch1Step-9:If i<l tehn goto step-2Step-10:EndAlgorithm of encryption() : DJSA methodTo create Random key of size (256x256x2) we input anytext-key which is also a secret key. The size of text-key mustbe less than or equal to 16 characters long. These 16characters can be any of the 256 characters (ASCII code 0 to255). The relative position and the character is important inour method to calculate the randomization number and theencryption number. To calculate randomization number, theencryption number from a given text-key we follow themethod described by Nath et. al[1].Now we will describe how we have made the randomkey of size 256x256x2 which is used for encryption as wellas for decryption purpose in DJSA. We create a random keyfile in a step by step manner as follows. As it is difficult tostore 131072(=256x256x2) elements in array hence we storethe entire key in a file. But we do in a step by step manner.We divide the entire key into 16 blocks where each blockcontains 64x64 words and each word contains 2 characters.We create each block separately in computer RAM and thenwe apply randomization methods one by one on it and thenwrite on to an external file again in some random order. Thebasic idea of randomization process is to make the keymatrix totally random.Now we show the original key matrix (16 x 16) whichcontains all characters (ASCII code 0-255):TABLE I. THE ORIGINAL MATRIX:Block-1 contains 64 lines where the first line contains thewords 00,01…063 and the last line contains630,631,….6363. Finally the block-16 contains the words191191,191192,…191..255 in 1stline and255191,255192,…255255 in the last line. Here each numbercorresponds to each character whose ASCII code liesbetween 0 to 255.The words in each block we generate in computerinternal memory and then apply 5 randomization methods[1] one after another in a random order and then write ontokey file again in random order.The following randomization process we apply seriallyon each block.Randomization stepsThe following Randomization are called one afteranother.Step-1: call function cycling()Step-2: call function upshift()Step-3: call function rightshift()Step-4: call function downshift()Step-5: call function leftshift()Now we describe the meaning of all above functionswhen we apply on a 4x4 matrix as shown below:Block-1(64X64X2)Block-2(64X64X2)Block-3(64X64X2)Block-4(64X64X2)Block-5(64X64X2)Block-6(64X64X2)Block-7(64X64X2)Block-8(64X64X2)Block-9(64X64X2)Block-10(64X64X2)Block-11(64X64X2)Block-12(64X64X2)Block-13(64X64X2)Block-14(64X64X2)Block-15(64X64X2)Block-16(64X64X2)
  • 4. TABLE II. ORIGINAL TABLEAA AB AC ADBA BB BC BDCA CB CC CDDA DB DC DDTABLE III. CYCLING( )BA AA AB ACCA BC CC ADDA BB CB BDDB DC DD CDTABLE IV. UPSHIFT()DA BA BB AADD CC CD ADDB CA DC BCAC CB AB BDTABLE V. RIGHTSHIFT()BD DA DB BACA BB DC AABC DD AC CCCB CD AB AD.TABLE VI. DOWNSHIFT()AD DC AB AABD BC DA DDDB AC BA CCCA CB BB CDTABLE VII. LEFTSHIFT()AB CC AA CAAD AC DC BADA CD DD DBBD CB BC BBThe above randomization process we apply for n-times(n=randomization number) and in each time we changethe sequence of operations to make the system more random.Once the randomization is complete we write one completeblock in the output key file.Now we show how we apply encryption process on aparticular file. For this we choose our last randomized 4x4matrix which is shown in table-8. We apply the followingencryption methods:Case-I : Suppose we want to encrypt DA and CD whichappears on the same row. Then the encrypted message willbe DD and DB. Case –II: Suppose we want to encrypt CCand AC where CC and AC appears on the same column inthe key matrix. The encrypted message will be CD and CB.Case-III: Suppose we want to encrypt AC and DD whichappears in two different rows and different columns then theencrypted message will be AD and DB.The decryption process will be just the opposite path ofencryption process. Please note that our method supports toimplement multiple encryption and multiple decryptionprocess.III. RESULTS AND DISCUSSIONSWe have implemented this algorithm in C language,theminimum hardware and software requirement is 32-bitoperating system and minimum 512MB of RAM foroptimal performance. We present some results someobtained in the following tables.TABLE VIII. TEST RESULTS FOR SMALL TEXTSKey:12Encryption number:5Sl.No.Original text Encrypted Text1(a) HE IS GOOD ê% -Åû¢e1(b) HE IS GOOF ì"/Çý¤g2(a) SHE IS GOOD. HE IS GOOD 7ZÞ=³»T“¢_µþÞ ˆçÙ¡Ð_2(b) SHE IS GOOD. HE IS GOOF 9à?µ½V•¤a· "à’ŠéÛ£Òa3(a) XXXXABCDCBAXXXX ´ú hÙa·+ dË>w·3(b) XXXXABCDCBAXXYX ·þ“lÝe»/¡hÏB{»4(a) XABCDEFGHX -1:Êro@˜Ê4(b) XABCDEFGXH Majú¢ŸpÈú@5(a) AAAAAAAAAAAAAAAA 抅 蛚頶휀5(b) AAAAAAAXAAAAAAAA •ïñàZŒAñc¼-ù©sJ6(a) AB C<6(b) AC D=6(c) AA B;6(d) AD E>6(e) BC GA6(f) CD KF7(a) ABA ³˜ä7(b) ACA ¶œè7(c) AAA °”à
  • 5. TABLE IX. TEST RESULTS FOR SMALL FILESIV. CONCLUSION:In the present work we have integrated two distinctmethods such as (i) DJSA and (ii) Generalized modifiedVernam Cipher method. We apply these two methods inrandom order depending on the value of the numberavailable in the ithlocation of the randomized key matrix.The vernam cipher method we have made general to encryptany character(ASCII code 0-255). We modify the methoddrastically by introducing the feedback value in the nextcolumn. We test our method closely on different types ofknown patterns where the same character repeats anynumber of times. The result shows that the encryptedmessage there is no repetition of character. We madeexhaustive study on small message and we found that if thereis minute change in the input string the encrypted text iscoming totally unpredictable. The present method may beapplied to encrypt short message, password encryption,ATM network, Mobile network, Defense network.This method may be further strengthened by introducingbit manipulation methods such as NJJSAA proposed by Nathet. al[6]. Due to complexity of our present method it will bealmost impossible to decrypt the encrypted message usingany brute force method.V. ACKNOWLEDGEMENTThe authors are very much grateful to Department ofComputer Science for getting opportunity to work onCryptography. One of the authors (AN) sincerely express hisgratitude to Fr. Dr. Felix Raj, Principal, St. Xavier’s College(Autonomous) and Fr. Jimmy Keepurum, Vice Principal(Arts and Science), St. Xavier’s College (Autonomous) forgiving constant inspiration and support to complete thisOriginal textST. XAVIER’S: 151 YEARS (1860-2011)A Brief History of the College(1860-1913)A host of seven Belgian Jesuits arrived at Calcutta in November 1859, under the leadership of Fr. H. Depelchin (Rector: 1860-1871), the FoundingFather of the second St. Xavier’s. They shifted St. Xavier’s from Chowringhee to the Sans Souci Theatre in January 1860, which is now the honesthome of learned professors and zealous students.With one hundred and fifty one years of service to the nation, St. Xavier’s College, Kolkata, hasgrown today into a leading educational institution in India. Both St. Xavier’s School and College are proud of their contribution to the cause ofeducation and culture in Bengal for 151 years. These twin institutions have produced many great educationists and students who earned regard andrespect for their Alma Mater. Fr. E. Lafont was appointed Rector in October 1871. He was a gifted teacher of Physics. The terrible cyclone ofNovember 1864 proved the beginning of his fame. The catastrophe might have been much greater, had not Fr. Lafont signalled the timely warning. Itwas Fr. O’Neill (Rector: 1904-1913) who gave the College its crest and the motto: Nihil Ultra, a motto, significant and suggestive of a noble ideal, ofan unconquerable hope, that urges the Xaverian to a consistent quest for the higher. The motto of the young Xaverian is the old maxim:“Perfectum nihil est, aliqiriddum restat agentiim” (Nothing is perfect as long as anything remains to be done).Encrypted Text(Screenshot in edit)
  • 6. project. AN is grateful to University Grants Commission forgiving financial assistance through Minor Research Project.DD and AN are also thankful to all 3rd year ComputerScience Hons. Students (2011-2012 batch) for theirencouragement to finish this work.VI. REFERENCES[1] Symmetric Key Cryptography using Random Key generator : AsokeNath, Saima Ghosh, Meheboob Alam Mallik: “Proceedings ofInternational conference on security and management(SAM’10” heldat Las Vegas, USA Jull 12-15, 2010), P-Vol-2, 239-244(2010).[2] A new Symmetric key Cryptography Algorithm using extended MSAmethod :DJSA symmetric key algorithm, Dripto Chatterjee, JoyshreeNath, Suvadeep Dasgupta and Asoke Nath : Proceedings of IEEECSNT-2011 held at SMVDU(Jammu) 3-5 June,2011, Page-89-94[3] Advanced Symmetric key Cryptography using extended MSAmethod: DJSSA symmetric key algorithm: Dripto Chatterjee,Joyshree Nath, Soumitra Mondal, Suvadeep Dasgupta and AsokeNath, Jounal of Computing, Vol3, issue-2, Page 66-71,Feb(2011).[4] Symmetric key Cryptography using modified DJSSA symmetric keyalgorithm, Dripto Chatterjee, Joyshree Nath, Sankar Das, ShalabhAgarwal and Asoke Nath,[5] Proceedings of Worldcomp-2011 held at Las Vegas(USA) 18-21July (2011), Page 306-311, Vol-I(2011).[6] New Symmetric key Cryptographic algorithm using combined bitmanipulation and MSA encryption algorithm: NJJSAA symmetrickey algorithm :Neeraj Khanna, Joel James,Joyshree Nath, SayantanChakraborty, Amlan Chakrabarti and Asoke Nath : Proceedings ofIEEE CSNT-2011 held at SMVDU(Jammu) 03-06 June 2011, Page125-130.[7] Modified Version of Playfair Cipher using Linear Feedback ShiftRegister, P Murali and Gandhidoss Senthikumar, UCSNSInternational Journal of Computer Science and Network Security,Vol-8, No.12, Dec 2008.[8] Crytography and Network Security, William Stallings, Prentice Hallof India.[9] Cryptography & Network Security, Behrouz A. Forouzan, TataMcGraw Hill Book Company[10] Cryptography and Information Security, V.K.Pachghare, PrenticeHall of India.[11] Cryptography and network Security,Atul Kahate,Tata McGraw-HillEducation.[12] Steganography in Digital Media-Principles,Algorithms,andApplications,Jessica Fridrich,Cambridge University Press.