)*.

1 ,(/-+032

THE INSTITUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS

034-

TECHNICAL REPORT OF IEICE.

7865'9

Two

ntt.<= (:.jp y NTT Multimedia Communications Laboratories 250 Cambridge Ave. Palo Alto. CA 94306.com ª­¬« OŒ€zKD!Š AES ¢Žƒ‡Q¢"œž§^b[Z!Š Two. 2) >? @A 3 B &C y 3 NTT FRUX_a[\]Ye`khE f 239-0847 Gnql #Hw~ ˆ¢g 1-1 shiho@isl.co.sh . USA yiqun@nttmcl..

sh ¢Lxp ©‰ ›šdi}{‚…¡¥¦ truncated di erential ©V|˜šj%cyS® 2057 3 žJT™ § 16 W truncated di erential ”mœ“›šd 251 †¢rvNM¡u˜c–¢ truncated di erential ¡„’ \good pair" £ 1 st˜c–¢¥’  good pair £‹i 277 st™§Ÿ} ž•§d¤šc Knudsen ¡¥¦ open problem Ÿ—¨‘šc 5 W¢ Two.

Two. . truncated di erential.sh © random permutation ŸPž•§$oI¢§ truncated di erential ”mœ“›šd : ¯°±´³´² µ·¸ ¶¹·¸ .

AES Cryptanalysis of Two.sh.

USA yiqun@nttmcl.sh (II) Shiho Moriai 3 Yiqun Lisa Yin y 3 NTT Information Sharing Platform Laboratories 1-1 Hikarinooka.ntt.jp y NTT Multimedia Communications Laboratories 250 Cambridge Ave. Japan shiho@isl. 239-0847.co..com which is one of the . Yokosuka. Palo Alto. CA 94306.

ve .

We also found 5-round truncated di erentials which can be useful in distinguishing Two. we found a 16-round truncated di erential with probability of about 2057 3. From our experimental results. and there are a total of 277 such good pairs.nalists for the Advanced Encryption Standard (AES). One can expect to get one good pair following the truncated di erential from 251 chosen plaintexts.

This was considered to be an open problem by Knudsen. : Abstract We present truncated di erential cryptanalysis of the block cipher Two.sh reduced to 5 rounds from a random permutation.

sh. truncated di erential. key words cryptanalysis. Two. di erential cryptanalysis.

AES .sh.

1 Introduction Two.

It is one of the .sh is a 128-bit block cipher proposed by Schneier et al. [SKW+98].

ve .

SSH Secure Shell. The best known attack on variants of Two. and so on [C99]. and it is used in many products such as GnuPG.nalists of AES.

sh claimed by the designers is an impossible di erential attack on 6-round Two.

Recently Knudsen [K00] showed that there are di erentials for Two.sh [F99].

predicting at least 32 bits of nontrivial information in every round. The probability of the truncated di erentials are too small to distinguish Two.sh for up to 16 rounds.

sh with more than a few rounds from a random permutation. but he claimed that it is possible. at least in theory. to .

nd one good pair of plaintexts following the di erential through all 16 rounds. Murphy and Robshaw [MR00] made some observations on key-dependent S-boxes and di erential cryptanalysis of Two.

Their approach was to choose the S-box to .sh.

t the di erential characteristic. instead of choosing the di erential characteristic to .

t the S-box. They found a 6-round di erential characteristic which holds for a fraction of at least 2020 of the S-boxes and claimed possible attacks of 8-round Two.

Table 1 summarizes the known results on cryptanalysis of Two.sh.

sh. In this paper we study truncated di erential cryptanalysis of Two.

Two. and the measure of di erence is exclusive-or. Note that Knudsen's truncated di erentials were based on the integer subtraction di erence between two 32-bit words.sh. The type of truncated di erentials to be used are \byte characteristics. the values of the di erence in a byte are distinguished between non-zero and zero." that is. which was left as an open question by Knudsen [K00]. we can make a thorough investigation of the non-uniformity in the distribution of the di erences. By using byte wise characteristics instead.

To search for byte characteristics of Two.sh consists of both byte-oriented and non-byte-oriented operations as shown in Figure 1. and PHT (pseudo-Hadamard transform). The non-byte-oriented operations include the 1-bit rotates. addition with subkeys. which comprises of two additions modular 232.

we consider truncated di erential probability of the MDS. n n n Ecient Computation of Truncated Di erential Probabilities of Addition Modular 2n In [M00]. but a straightforward extension to the case of truncated di erentials can still be computationally very expensive. In this section. Based on the ecient computation of di erential probability of addition modular 2 shown in [M00]. an ecient algorithm was presented for computing di erential probabilities of addition mod 2 . we study how to further speed up the n n 2 round whitening key size 4 w/ any 6 w/o 128 6 w/o 192 6 w/o 256 6 w/ 256 8* w/ any cryptanalysis complexity conditions distinguishing attack impossible di erential 2128 impossible di erential 2160 impossible di erential 2192 impossible di erential 2256 di erential attack | > 2020 fraction of the S-boxes Table 1: Two. we give an ecient computation of truncated di erential probability of addition modular 2 in Section 2. In Section 3. Finally in Section 4 we present the truncated di erentials that we found by computer experiments. The algorithm can be extended to compute truncated di erential probabilities of addition of 2 . we begin by computing the truncated di erential probability of addition modular 2 .sh.

sh cryptanalysis reference [K00] [F99] [F99] [F99] [F99] [MR00] .

K0 K1 S-box 0 S-box 1 S-box 2 S-box 3 S-box 0 S-box 1 <<<8 K2 PHT MDS K2r+8 <<<1 K3 input whitening 1 round S-box 2 S-box 3 MDS >>>1 K2r+9 : 15 more rounds K4 K5 K6 K 7 whitening output Figure 1: Two.

We will follow the de.sh computation of truncated di erential probabilities.

and here we will only restate some of them if they are directly related to our discussion below. For x.nitions and notation in [M00]. y. z 2 GF(2) . the function addition mod 2 is de.

ned as follows: f (x.y) = x + y = z (mod2 ): We divide 1x 2 GF(2) into t-bit sub-blocks and denote them by 1x[0 ] . 1x[1 ]. :: : from the least signi.

The truncated di erential probabilities for f are de. where m = n=t is the number of sub-blocks. 1z)) is given in [M00]. A very ecient algorithm for computing di erential probabilities of f (denoted by DP (1x. 1x[1 ]. 1y. 1z). 1y. while a naive approach would require a running time of O(22 ). the running time of the algorithm is O(n)1. :: :.cant sub-block. So 1x = (1x[ ]01. 1x[0 ] ). For each triplet (1x.

computation of all truncated di erential probabilities using Equation (1) can still be very expensive.g. Some of these truncated di erentials may have a very large c value. we have c  248.y. 1z). TDP (x. 1y.ned as follows.z) = 1 DP (1x. So the number of possible truncated di erentials is (2 )3 = 212. Let wH(x) denote the Hamming weight of x. byte characteristics). y). 1y) = (x. Therefore. we have n = 32 and t = 8. even when the di erential probabilities themselves can be calculated eciently.. . 1y) satisfying the condition (1x. y. y. Then it is easy to see that c = (2 0 1) H( )+ H( ): In a typical setting (e.z ) f 1 Later the complexity was further improved to 2(log n) in the worst-case and 2(1) in the average-case. t w x w y n=t (1 1 1 )=( x. when wH (x) + wH (y)  6. x. For example. (1) c n n n n t t t t t m f n f X z  where c is the number of pairs (1x.

1 Basic idea The main idea for speeding up the computation of truncated di erential probabilities is to treat each sub-block somewhat independently.2. More speci.

cally. we will .

rst compute some properly de.

y. For each sub-block. z ) be the values of (x. and then we will join these probabilities together to obtain the total truncated di erential probability for f . we de.y . there are only three possible values for P1 : 0.5. 1. For a give sub-block (the ith sub-block).  Let P1 P1 = Pr[1cout = 1]: Based on the results in [M00]. we need to consider both the di erence in the carryin (denoted by 1cin) from the previous sub-block and di erence in the carryout (denoted by 1cout) to the next sub-block.  There are two possible values for 1cin: 0. 0. z) restricted to the sub-block. 1.ned \partial sums of di erential probabilities" for each sub-block ignoring the carry from one sub-block to the next. let (x . Below.

P1 = p: cout cout i i i cout is.ne 6 partial sums for the di erential probabilities. 1y [ ].p) for d = 0.P1 ) = (d.z . 0:5.z ). 1z[ ] ). d.y . Condition PS where Condition PS is (1x[ ].2 Detailed algorithm Our algorithm for computing truncated di erential probabilities contains two major components: precomputing partial sums and joining partial sums of sub-blocks. depend on the  values restricted to a particular sub-block. 1 and p = 0. So the total number of partial sums to be stored is 23 2 6 = 48. each x . 1y[ ] . 1. z is just a single bit. 1z [ ]) = (x . one corresponding to a possible combination of (1cin. Typically. cout denote the probability that there is carry from one sub-block to the next. these partial sums can be precomputed and stored in a table. y . PS(x . That X i t i i i t t t i i i t t i i i i i cout 2.p) (2) = DP(1x[ ] . 1cin = d. i i i Precomputing partial sums We observe that the partial sums de. Therefore. y .

Let PS (x .z .z +1jjz . y +1 .ned by Equation (2) only of length t bits).p). PS (x +1. d.z +1. we can compute the partial sums for the sub-block H jjL of length 2t bits. d. and PS jj (x +1 jjx . p) L i i i H i i i H L i i i i i i Joining sub-blocks Given the partial sums for any two consecutive sub-blocks H and L (each . y .d.y +1jjy .p).

Computing the total TDP By repetitively joining successive sub-blocks. we can obtain the 6 partial sums PS(x. 1.p) 2 PS (1. 1.d. 1. 0) + PS (1.d. 1. we can compute the new partial sums for the sub-block H jjL of length (t1 + t2 ) bits. 0. Then PS jj is computed as PS jj (1.y.p) 2 PS (1. 1. 1.d. 1. d.d. 1. Using the above formula. 1. 1) + PS (1. 0. 0:5) 2 0:5 ]: H L H L H L H L H L H L In general.p) = [ PS (1. 1.denote the partial sums of di erential probabilities for the corresponding sub-blocks. respectively. 1. d. 1. 1.p) 2 PS (1. Since 1cin = 0 for the least signi. 1. the two sub-blocks H and L can have any number of bits. 1. 1. say t1 and t2 . 1. 1.z. 1.p) 2 PS (1.p) for the entire block of length n. 0:5) 2 0:5 + PS (1. 1.

Therefore. 0. the total truncated di erential probability is TDP (x. y.z) = 1 PS(x. 0. y. For n = 32 and t = 8. 0:5) ]: f of x and y. each of the 212 truncated di erential probabilities can be computed using a constant number of table lookups.cant sub-block. Experiments show that all the 212 probabilities can be computed in less than one second on a PC. additions. y. 0. Eciency analysis The algorithm given in this section is independent of the Hamming weight 3 Truncated Di erential Probabilities of MDS The truncated di erential probabilities for the MDS are de. y. z. z. 1) + PS(x. z. 0) c 2[ + PS(x. 3 of these partial sums (for which d = 1) actually have value zero. and multiplications.

as Table 2 shows.y where c is the number of 1x satisfying the condition (1x) = x. The distribution of TDPMDS (x. x. TDPMDS (x.ned as follows. y) = 1 c (1 1 )=( ) Pr[MDS(x) 8 MDS(x 8 1x) = 1y].y) is related to the weight distribution of the MDS (Maximum Distance Separable) code. TDPMDS (x.y) is determined by the Hamming weights of x and y. 4 Search for Truncated Di erentials of Two. X y (3)  x.

sh In this section. we present our search results for truncated di erentials of Two.

Our search uses the di erential probabilities of PHT and MDS computed in Sections 2 and 3. we .sh. For speeding up the search.

Once we found the truncated di erentials. For example. if the input di erence of the 1-bit right rotation is 8. Otherwise. we then adjust the probability as follows. we need some adjustment.rst set the probability to be one for 1-bit rotations. the output di erence is still f. the output 2 In this section we use typewriter font for the hexadecimal representation of truncated di erentials. If the input di erence (32-bit) of the 1-bit rotation is f2 . .

c with probability 201 0 208 and 4 with probability 208 (here we have multiple paths. the value corresponding to k = 0 in our precomputed table gives the truncated di erential probability when we average over all possible keys. where k is some subkey). but in most cases the multiple paths join at the next MDS).wH (y) wH (x) 0 1 2 3 4 0 1 0 0 0 0 1 0 0 0 0 1 2 0 0 0 207 994 200 023 3 0 0 2015 989 208 017 200 023 4 0 2023 983 2016 012 208 017 200 023 Table 2: Truncated di erential probabilities of MDS : : : : : : : : : di erence is 8 with probability 201.. f (x.e. For additions with subkeys (i. For any .k) = x + k = z (mod 2 ).

There are a total of 294 such good pairs. the output di erence of each round are shown in hexadecimal representation. although they may not be exploited in general (well-known) cryptanalytic attacks. As Knudsen [K00] wrote. we set the probability to be one for additions with subkeys. Our computer experiments found a 12-round truncated di erential with probability of about 2040 9. In Table 3. the probability depends on k. For easy treatment of probability after the search. and it can be larger or smaller than the average probability: the maximum probability can be 1 for a fraction of the subkeys. n 4. One can expect to get one good pair following the truncated di erential from about 234 chosen plaintexts by using a structure in the last byte of the plaintext. More interestingly. we found a truncated di erential for the full 16 rounds of Two. we searched for truncated di erentials that hold with relatively high probability.xed subkey k.1 Truncated di erentials with high probability First. such di erentials can provide some bits of nontrivial information in every round.

2 Truncated di erentials useful for distinguishing attacks We also searched for truncated di erentials that may be useful in distinguishing attacks. Knudsen concluded that for more than 4 rounds. we found one 4-round truncated di erential. and the total number of good pairs for our di erential is also much larger. : : 4. The probability of our 16-round truncated di erential is much higher than what was found by Knudsen. . The 4-round truncated di erential is a path included in the 4-round truncated di erential that Knudsen used for the 2-tests in [K00. As a result. and there are 228 such good pairs. in theory we can perform statistical tests such as 2 tests. Now that we found 5-round truncated di erentials with probability slightly higher than a random permutation.sh with probability of about 2057 3 (see Table 4).2]. One can expect to get one good pair following the truncated di erential from about 2100 chosen plaintexts. Note that the probabilities in Table 5 can be a little smaller due to 1-bit rotations or a little larger due to the e ect of multiple paths. it is an open question how nonuniform the distribution of di erences can be. Section 5. and four 5-round truncated di erentials (see Tables 6 and 5). Note that Knudsen's 4-round truncated di erential contains multiple paths and the probability is much higher. In [K00] Knudsen showed a 16-round truncated di erential with probability 20256 .

round probability 1 0 0 0 1 20 000000 2 0 1 f f 200 028330 3 f f f e 208 118785 4 f e f f 208 209239 5 f f 7 f 2016 299694 6 7 f f f 2016 390147 7 f f b f 2024 480603 8 b f f f 2024 571056 9 f f 7 f 2032 661511 10 7 f f f 2032 751965 11 f f b f 2040 842420 12 b f f f 2040 932874 Table 3: 12-round truncated di erential : : : : : : : : : : : : round probability 1 0 0 0 1 20 000000 2 0 1 f f 200 028330 3 f f f e 208 118785 4 f e f f 208 209239 5 f f 7 f 2016 299694 6 7 f f f 2016 390147 7 f f b f 2024 480603 8 b f f f 2024 571056 9 f f 7 f 2032 661511 10 7 f f f 2032 751965 11 f f b f 2040 842420 12 b f f f 2040 932874 13 f f 7 f 2049 023329 14 7 f f f 2049 113783 15 f f b f 2057 204238 16 b f f f 2057 294692 Table 4: 16-round truncated di erential : : : : : : : : : : : : : : : : 5 Conclusion We presented truncated di erential cryptanalysis of the block cipher Two.

and found a 16-round truncated di erential with probability of about 2057 3. We performed the search by computer experiments. which is much larger than previously known results. We also found 5-round truncated di erentials which can be useful in distinguishing Two.sh.

sh reduced to 5 rounds from a random permutation. We will implement some tests to con.

\Impossible di erentials in Two. : References [C99] http://www.counterpane.html [F99] N. Ferguson.com/twofish-products.rm our conjecture.

sh." Two.

sh Technical Report #5. R. 1999.counterpane. http://www. \Trawling Two.com/twofish-impossible. Knudsen.html [K00] L. October 5.

" Fast Software Encryption | Second International Workshop.html. R. M. Robshaw. pp.gov/encryption/aes/round2/conf3/aes3agenda.nist. \Truncated di erentials of SAFER. B. 1995. Lecture Notes in Computer Science 1666. 1999.gov/encryption/aes/round2/comments/20000515-lknudsen-2." Fast Software Encryption. Wagner. A. Lecture Notes in Computer Science 1039. 1996. http://csrc. pp. Public comment on AES Candidate Algorithms { Round 2. L. Knudsen.pdf [K95] [KN96] [KRW99] [M00] L. \Truncated Di erentials and Skipjack. \Truncated and Higher Order Di erentials. | 3rd International Workshop. R. Moriai. and D. Knudsen and T." Presentation at rump session of AES3. R.\Cryptanalysis of Two. Knudsen. S.196{211.165{180. L. Springer-Verlag. Berson. http:// csrc." Advances in Cryptology | CRYPTO'99. J.15{26. pp. Springer-Verlag.nist.sh (revisited). Springer-Verlag. Lecture Notes in Computer Science 1008.

sh (I)". . Japan. 2000. January 26-28. Okinawa. In Proceedings of the 2000 Symposium on Cryptography and Information Security.

Murphy and M. and Two. Key-dependent Sboxes.round probability 1 0 0 8 0 20 000000 2 8 0 f f 200 011377 3 f f 8 0 2055 977519 4 8 0 0 0 20119 988896 5 0 0 8 0 20119 988896 1 0 0 c 0 20 000000 2 c 0 e e 208 001936 3 e e c 0 2055 981278 4 c 0 0 0 20111 983214 5 0 0 c 0 20111 983214 1 0 0 e 0 20 000000 2 e 0 c c 2015 992496 3 c c e 0 2055 985038 4 e 0 0 0 20103 977534 5 0 0 e 0 20103 977534 1 0 0 f 0 20 000000 2 f 0 8 8 2023 983060 3 8 8 f 0 2055 988804 4 f 0 0 0 2095 971864 5 0 0 f 0 2095 971864 Table 5: 5-round truncated di erentials : : : : : : : : : : : : : : : : : : : : round probability 1 0 0 8 0 20 000000 2 8 0 f f 200 011377 3 f f 8 0 2055 977519 4 8 0 f f 2055 988896 Table 6: 4-round truncated di erential : : : : [MR00] S.B Robshaw.J. \Di erential Cryptanalysis.

(to appear in Lecture Notes in Computer Science. J. http://csrc. and M. Kanda. Sugita. Tokita.133{143. and N.sh". pp. D. pp." Fast Software Encryption. C. Whiting. 6th International Workshop. Schneier.gov/encryption/aes/round2/comments/20000515-smurphy. [SKW+98] B. Kelsey. 1999.nist. Public comment on AES Candidate Algorithms . Matsui and T. \Security of E2 against Truncated Di erential Cryptanalysis. 6th Annual International Workshop on Selected Areas in Cryptography. Moriai. Springer-Verlag.Round 2. \Two. M. Aoki. Wagner. 2000). K. 1999. Ferguson. \Cryptanalysis of a Reduced Version of the Block Cipher E2.71{80. [MT99] M. Springer-Verlag. pdf [MSAK99] S. Hall. D." SAC'99. Workshop Record. Lecture Notes in Computer Science 1636.

com/twofish.counterpane.sh: A 128-Bit Block Cipher".html . http://www.