ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 Enhancement of Stream Cipher by Using Variant Register in Length N. A. Taha Departme nt of Computer Science,College of Education I bn Al-Haitham, Unive rsity of Baghdad Received in: 18 May 2011, Accepte d in: 16 June 2011 Abstract Stream cip hers are an imp ortant class of encryption algorithms. There is a vast body of theoretical knowledge on st ream ciphers, and various design p rinciples for st ream ciphers have been p rop osed and extensively analyzed. This p aper p resents a new method of st ream cip her, that by segmenting the plainte xt into number of register then any of them comb ined to any other by using comb ination logic cir cuit (And, OR, JK, NOT, XOR), then using variant regist er in len gth as a key which p rovides security enhancement against att acks and then comp are the strength of this method with RSA by calculaing the time necessary to get the original t ext by usin g the genetic algor ithm. And t he way that has t he lon gest time is the best in encryption. Then it was found that p rop osed method is st ronger in encry ption than RSA. Keyword: st ream cip her, variant register, genetic algorithm, complexity . Introduction Stream cip hers are an imp ortant class of encryption algorithms. They encrypt individual characters (usually binary digits) of a p laintext message on e at a time, usin g an encry ption transformation which varies with time. Various design methods where p rop osed for st ream cip hers and the sp ecialist s p rop osed many analysis methods. However, one p ossible exp lanation can be the fact that many stream cip hers used in p ractice tend to be p rop rietary and confidential. A st ream cip her generates what is called a keystream (a sequence of bits used as a key). Encry ption is accomp lished by a simple op eration comb inin g the k eyst ream with the p laintext, usually with the bitwise XOR op eration [1]. Types of Stream Cipher A stream cipher gener ates successive elements of the key stream based on an internal st ate. This state is up dated in essentially two way s: if the state changes independently of the p laintext or cip hertext messages, t he cipher is classified as a synchronous st ream cipher. By contrast ,self-synchronising st ream ciphers up date their state based on p revious ciphertext digits.  S ynchronous stream ciphers In a sy nchronous st ream cip her a st ream of p seudo-random digits is generated indep endently of the plaintext and cip hertext messages, and then combined with the plaintext (to encrypt) or the cip hertext (to decryp t). In the most common form, binary digits are used (bits), and the keystream is combined with the p laintext using the exclusive or op eration (XOR). This is termed a binary additive st ream cipher. ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 In a sy nchronous stream cip her, the sender and receiv er must be exactly in st ep for decry ption to be successful. If digits are added or removed from the message dur ing transmission, sy nchronisation is lost. To restore sy nchronisation, various offsets can be tried systematically to obtain the correct decryption. Another app roach is to tag the ciphertext with markers at re gular points in the output. If, however, a digit is corrup ted in transmission, rather than added or lost, only a sin gle digit in the p laintext is affected and the error does not p rop agate to other parts of the message. This p rop erty is useful when the transmission error rate is high; however, it makes it less likely the error would be d etected without further mechan isms. M oreover, because of this p rop erty , sy nchronous stream cip hers are very susceptible to active att acks — if an att acker can chan ge a di git in the ciphertext, he might b e able to mak e p redictable chan ges to the corresp onding p laintext bit; for examp le, flipp ing a bit in the ciphertext causes t he same bit to be flipped in the plaintext. [2] Binary additive st ream cip her is a sy nchronous st ream cip her in which the k eyst ream, p laintext, and cip hertext denoted are sequences of binary digits, and keyst ream is combined with the plaintext using XOR op eration to output cip hertext. For each secret key, the st ream cip her gener ates a different deterministic keystream sequence. Since it is assumed that K is a shared secret between the transmitter and receiver, receiver p roduces the same k eyst ream sequence and obtains p laintext by XOR'ing cip hertext with keystream. In the remaining p arts of the study , we supp ose the stream cipher is a binary additive st ream cip her unless ot herwise is st ated.[3]  Self-synchronizing stream ciphe rs Anot her approach uses several of the p revious N cip hertext digits to comp ute the keystream. Such schemes are known as self-sy nchronizing st ream ciphers, asy nchronous st ream cip hers or cip hertext autokey (CTAK). T he idea of self-sy nchronization was p atented in 1946, and has the advantage that the receiver will automatically sy nchronise with the keystream generator after receivin g N cip hertext digits, making it easier to recover if digits are dropp ed or added to the message st ream. Single-digit errors are limited in their effect, affectin g only up to N p laintext digits. An example of a self-sy nchronising st ream cip her is a block cip her in cip her feedback (CFB) mode.[2]  Genetic algorithm A genetic algor ithm is on e of a r elatively new class of st ochast ic search algorithms. Stochast ic algorithms are those that use p robability to help guide their search. GAs behaves much lik e biolo gical genetics. GAs encoded information into st rings, just as living or ganisms encoded characterist ic into stands of DNA [4] Re view of Previous Works 1. M artin Boesgaard, at al. in [5], Presented a new st ream cip her, Rabbit, based on iterating a set of coupled nonlinear functions. Rabbit is characterized by a high p erformance in soft ware with a measured encryp tion/decryption sp eed of 3.7 clock cycles p er byte on a Pentium III p rocessor. We have r eformed detailed security analysis, in p articular, correlation analysis and algebraic invest igations. The cry ptanalysis of Rabbit did not reveal an attack bett er than exhaustive key search. 2. Hongjun Wu,IN. in [6] . It gener ates keyst ream from a 256-bit secret key and a 256-bit initialization vector. T he encryp tion sp eed of the C imp lementation of HC-256 is about 1.9 bits p er clock cycle (4.2 cycle/by te) on the Intel Pentium 4 p rocessor. A variant of HC-256 is also introduced in this p aper. ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 3. Imran Erguler, Orhun KaraI in [7], in this study , p rop ose a new keyst ream based encry ption model ; firstly app ly forward error correctin g codes (FEC) to p laintext. Ne xt, add a nondeterministic noisy sequence to keyst ream and obtain a nondetermin istic bit sequence which is combined with p laintext to gener ate cip her text. Even though the receiv er does not know t he content of t he nondeterminist ic sequence, he can st ill obtain the or iginal message. These forces a new definition for cryp tanalysis of keystream sequences in case of known p laintext. A General Description of the Proposed Model Below is a presentation of a new approach for encryption sy stem in which plaintext is XOR’ed with a keystream sequence. For this model at t he transmitt er site, firstly the plaintext sequence V was encoded to ASCII cod e A and then encoded to binary code sequence P. Second ly the binary p laintext P was segmented into to one or more registers denoted by Ri (i=1,2,3…….,9) then any of them combined to any other by using combination logic c ircuit (And, OR, JK, NOT, XOR), these logic gates can b e used r andomly and can use the same logic gate more than once , but their use should be limited and thoughtful because if it is used in non-carefu lly st udied and rep etitive manner, it may lead to p oor results obt ained. Then, the final register havin g p rimary cip hertext Cp. Various p rop erties of such a logic gates function are imp ortant for ensuring the security and can make it extremely difficult to guess p laintext that means it p rovides more security enhancement against att acks, as shown in figure-1 Next, this p rimary cip hertext Cp is combined with key stream to gener ate final cip hertext Cf Key s tream A key stream sequence is p roduced by seed and it is m ixed with p lain text for encry ption at the transmitt er side note that key stream sequence is deterministic anyone havin g the seed can reproduce it, and recover the plainte xt easi ly. Therefore, for stream cip her security of the cip hertext relies on the security of the key st ream. In this model, a new key st ream was p rop osed in a based encry ption model which p rovides security enhancement against some well known attacks. First a key stream was created from p rimary cip hertext Cp . The length of the encryption key is randomly variable fro m 15-25% p ercent of the len gth of p rimary cip hertext Cp. after that this key is XOR’ed with p rimary cip her text to obtain the final cip hertext Cp k = Cf This change in the key len gth, add further st rength to the p rop osed method which enhanced and increased in the st rength of encry ption against att ack. Main Algorithm 1- Call stream cip her algorithm creator 2- Call RSA algorithm 3- Call co mplexity checker Algorithm of stream cipher 1- Inp ut data file 2- Store data file in memo 3- Do 4- Sp lit input line to register 5- Create key for current register 6- Put key as p art of stream ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 7- Stream=stream + current register 8- While input line = end of data 9- Put end of stream 10- Save st ream as file Complexity checker The final st age of this work is to measure the comp lexity strength of encryption by comp aring with one of encry ption method known RSA, that by taking a sample from text encry pted in the prop osed method denote by (S1s) with t he same samp le but an encry p ted by RSA method denote by ( S1R ) and then calculate the time necessary to get to the same sample in original text denoted by ( S1O ) by using genetic algor ithm. Genetic algorithm is used to comp ute the time required to decipher the cip hertext to p roduce the plaintext. Genetic algor ithm begins with randomly generating an initial p op ulation of P size chromosome is evaluated by the chromosome’s length equal to the length of the samp le S1S. The fitness of each chromosome comp arin g the chromosome with the S1O (the sample from original t ext), after that Crossover and mutation are ap p lied on the p op ulation to create a new p op ulation. Supp ose the time required to the first samp le S1S is T1 and to t he sample S1R is T2, as shown in figure- 2 If T1 is greater than T2 then the p rop osed method is the best. This is done for 8-15 samp les deend on the size of the plaintext. For example, after p laintext sequence was encod ed to ASCII code and then encod ed to binary code sequ ence, the p laintext was se gmented into 3 registers and then register 1 was combined with register 2 by XOR gate, register 2 with re gister 3 combined by AND gate and regist ers 1& 3 are combined by OR gate to generate p rimary cip hertext then create a key for current regist er after that this key is XOR’ed with p rimary cip her text to obtain the final cip hertext as shown in figure- 3. For t he same example, Table-1 shows the difference between the times required to decipher the sample cip hering by p rop osed method T1 & Time required to decipher the same sample cip hering by RSA methods T2 that done for 10 samples. It was noted that the p rop osed method takes t ime longer than the RSA method to get to the original text and this means that the prop osed method is the strongest in terms of encryp tion Algorithm of complexity checker 1- Read cip her file 1 2- Read cip her file 2 3- Read p laintext 4- Select samp le from file 1 and file 2 5- Start analy sis with calculated time for two samples t o reach to the plaintext Not e: the analy sis dep end on genetic algorithm 6- If T file 1 > T file 2 then file 1 is c ipher better Result and Discussion Figures 3, 4, 5 & 6 are graphed by p lotting the difference b etween T1 &T2 (T1-T2) and joining the successive point t o a number of samp les by a line. The Sum complex represents the number of samp le. T1 is the time required to decip her the sample is cip hered by p rop osed method. ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 T2 is the time required to decip her the sample is cip hered by RSA. From the se figures it can be noticed many points: 1. In the figure -3 and table-1 that t he use of key variable in length leads to increase the strength of encryption comparison with RSA method. 2. A comparison between Figure 3 and 4 that t he use of logic c ircuits have helped to increase the st rength of encry p tion where it is noted in table -2 that the time needed to decryp t the code in a RSA which became in 4 samples greater than the time of the p rop osed method. In other words, the strength of encryp tion is becomin g less with absence of lo gic circuits 3. The use of logic gates frequently and non-thoughtfully could lead to reverse results as seen in figure -5. This was seemed clear in Table-3, where the time n eeded to decry pt the samp le cip hered by a RSA which b ecame in 7 samples greater than the time of the p rop osed method. 4. In the figure-6 that the use of large number of regist ers in inp ut leads to reduce the st rength of encryption, esp ecially if the size of text is small. This seems clear from Table-4 where the time needed to decry p t the samp le cip hered by a RSA which became in 6 sa mples greater than the time of the p rop osed method. Conclusion In this p rop osed method using variant register in len gth as a key in st ream cip her which p rovides security enhancement against att acks, and can conclude many p oints as follows: 1- The use of variable key in len gth and number of logic gates has helped to increase the st rength of encryp tion. 2- The use of logic gates must be limited and thoughtfully , because the frequent use of the same lo gic gate may lead to reduce the strength of encry p tion. 3- The use of a suitable number of registers in the inp ut leads to increase the strength of encry ption (the number of registers that are used dep ends on the size of text). 4- This p rop osed method is suitable for image encry p tion too t hat can be done by using p ixel valu e instead of the ASCII code of the letter and convert this p ixel to binary code, and then can b e used the same algorithm above Re ference 1- Bucerzan, D.; Craciun, M .; Chis, V.and Ratiu, C.(2010), Stream Cipher Analysis M ethods, Int. J. of computer, communications& Control, ISSN 1841-9836, E-ISSN 1841-9844 , V (4) : 483-489 ,483-489. 2- M att, J.and Robshaw, B.(1995), Stream Ciphers Technical Report TR-701, version 2.0, RSA Laboratories, 5-8. 3- M enezes, A.; Vanosrschot, P. and vanston, S.(1996), Handbook of applied cryptography , by CRC p ress LLc, ch 6, 194. 4- Grant, K. (1995), An introduction to gentic algorithms "march , c/c++ users Journal,13 (3) : 45-58. 5- Boesgaard M ., Vesterager M ., Pedersen T., Christiansen J., and Scav enius O.(2010), CRYPT ICO A/S, Fruebjer gv ej, p aper ,Rabbit: New Hi gh-Performance Stream Cipher, Cop enhagen , Denmark, p p .3-4 6- Hongjun, Wu.(2004), Full version of the FSE 2004 p aper, “A New Stream Cipher HC-256, Last revised Ap ril 15,2-3. 7- Ergu ler, I. and Kara, O.(2007), A New Ap p roach to Key stream Based Cry ptosy stems, INFORMATION SECURTIY & CREPTOLOGY CONFERENCE WITH ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 INT ERNATIONAL PARTICIPATION Journal, ISC Turkey, Aralik, Ankara,December,13- 14 . Table(1): Time required to decipher the sample that ciphered by propose d &RS A methods for 10 samples S amples Time requi red to decipher the sample ciphered by propose d method in sec T1 Time requi red to decipher the sample ciphered by RS A in sec T2 S1 15.23 15.21 S2 16.02 4.14 S3 17.12 17.01 S4 14.3 7.72 S5 15.14 13.06 S6 17.27 4.21 S7 12.81 9.13 S8 13.03 4.14 S9 10.13 7.92 S10 16.21 2.31 Table(2): Time required to decipher the sample that ciphered by propose d &RS A methods for 10 samples without using logic gates S amples Time requi red to decipher the sample ciphered by propose d method in sec T1 Time requi red to decipher the sample ciphered by RS A in sec T2 S1 10.24 13.95 S2 16.02 3.14 S3 16.12 14.01 S4 14.3 10.72 S5 13.14 18.46 S6 15.84 1.64 S7 11.31 12.83 S8 14.03 3.64 S9 6.13 9.22 S10 14.61 1.31 ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 Table(3): Time required to decipher the sample that ciphered by propose d &RS A methods for 10 samples with Using logic gate freque ntly Table(4): Time required to decipher the sample that ciphered by propose d &RS A methods for 10 samples with Using 8 register in input S amples Time requi red to decipher the sample ciphered by propose d method in sec T1 Time requi red to decipher the sample ciphered by RS A in sec T2 S1 10.34 13.54 S2 15.02 12.24 S3 11.02 18.81 S4 15.3 17.12 S5 16.71 12.06 S6 13.27 13.71 S7 12.21 20.13 S8 14.03 23.14 S9 10.13 12.92 S10 9.21 15.71 S amples Time requi red to decipher the sample ciphered by propose d method in sec T1 Time requi red to decipher the sample ciphered by RS A in sec T2 S1 7.23 16.41 S2 17.02 13.86 S3 6.12 19.01 S4 10.3 17.72 S5 8.14 21.75 S6 17.27 19.21 S7 14.81 22.13 S8 13.32 7.14 S9 20.03 9.92 S10 15.31 13.97 ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 Fig.(1): Describes the propose d method Ciphertext using T1 T2 Ciphertext using Stream cip her RSA Plaintext Fig.(2): Describes the way to measure the complexity strength of encryption S1S S1R S1o ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 Fig .(3): Example for propose d method Fig .(4): THE propose d method without using logic gates ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 Fig.(5): Using logic gate frequently Fig.(6): Using 8 register in input ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012 تعزیز طریقة التشفیر االنسیابي باستعمال مفتاح تشفیر متغیر في الطول نمار عبدالملك طه ابن الهیثم ، جامعة بغداد-قسم علوم الحاسبات،كلیة التربیة 2011 حزیران 16: ، قبل البحث في 2011 ایار 18: استلم البحث في الخالصة و اقترحت ،شفیر وهناك مجموعة واسعة من المعرفة النظریةتالتشفیر االنسیابي هو نوع مهم من خوارزمیات ال البحث اقترحت طریقة جدیدة للتشفیر االنسیابي وفي هذا ،تصامیم مختلفة للتشفیر االنسیابي وحللت على نطاق واسع ة الى عدد من المسجالت وبعدها تجمع هذه المسجالت مع بعضها باستعوذلك بتقسیم النص األصلي مال البوابات المنطقی د و تشفیرا إبتدائیا ومن ثم یجمع مع مفتاح تشفیر هو مسجل ذدوهذا یع طول متغیر الذي یعزز من قوة التشفیر ض و ذلك بحساب الزمن الالزم ) RSA(وبعد ذلك تقارن قوة هذه الطریقة مع طریقة معروفة و هي . الهجمات المعروفة و الطریقة التي تمتلك زمن اطول هي االفضل بالتشفیر و قد . للحصول على النص االصلي باستعمال خوارزمیة الجینیة .شفیر من الطریقة الثانیة توجدت ان الطریقة المقترحة اقوى في ال قوة التعقید، لجینیةالخوارزمیة ا،مسجل متغیر، التشفیر االنسیابي : الكلمات المفتاحیة ة مجلة إبن الھیثم للعلوم الصرفة و التطبیقی 2012 السنة 25 المجلد 1 العدد Ibn A l-Haitham Journal f or Pure and Applied Science No. 1 Vol. 25 Year 2012