Professional Documents
Culture Documents
1 ,(/-+032 034-
THE INSTITUTE OF ELECTRONICS, TECHNICAL REPORT OF IEICE.
INFORMATION AND COMMUNICATION ENGINEERS
shiho@isl.ntt.co.jp
y NTT Multimedia Communications Laboratories
yiqun@nttmcl.com
Abstract We present truncated dierential cryptanalysis of the block cipher Twosh,
which is one of the ve nalists for the Advanced Encryption Standard (AES). From our
experimental results, we found a 16-round truncated dierential with probability of about
2057 3. One can expect to get one good pair following the truncated dierential from 251
:
chosen plaintexts, and there are a total of 277 such good pairs. We also found 5-round
truncated dierentials which can be useful in distinguishing Twosh reduced to 5 rounds
from a random permutation. This was considered to be an open problem by Knudsen.
key words cryptanalysis, dierential cryptanalysis, truncated dierential, Twosh, AES
1 Introduction
Twosh is a 128-bit block cipher proposed by Schneier et al. [SKW+98]. It is one of the
ve nalists of AES, and it is used in many products such as GnuPG, SSH Secure Shell, and
so on [C99]. The best known attack on variants of Twosh claimed by the designers is an
impossible dierential attack on 6-round Twosh [F99]. Recently Knudsen [K00] showed that
there are dierentials for Twosh for up to 16 rounds, predicting at least 32 bits of nontrivial
information in every round. The probability of the truncated dierentials are too small to
distinguish Twosh 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 dierential
through all 16 rounds. Murphy and Robshaw [MR00] made some observations on key-dependent
S-boxes and dierential cryptanalysis of Twosh. Their approach was to choose the S-box to t
the dierential characteristic, instead of choosing the dierential characteristic to t the S-box.
They found a 6-round dierential characteristic which holds for a fraction of at least 2020 of the
S-boxes and claimed possible attacks of 8-round Twosh. Table 1 summarizes the known results
on cryptanalysis of Twosh.
In this paper we study truncated dierential cryptanalysis of Twosh. The type of truncated
dierentials to be used are \byte characteristics," that is, the values of the dierence in a byte are
distinguished between non-zero and zero, and the measure of dierence is exclusive-or. Note that
Knudsen's truncated dierentials were based on the integer subtraction dierence between two
32-bit words. By using byte wise characteristics instead, we can make a thorough investigation
of the non-uniformity in the distribution of the dierences, which was left as an open question
by Knudsen [K00].
Twosh consists of both byte-oriented and non-byte-oriented operations as shown in Figure 1.
The non-byte-oriented operations include the 1-bit rotates, addition with subkeys, and PHT
(pseudo-Hadamard transform), which comprises of two additions modular 232. To search for
byte characteristics of Twosh, we begin by computing the truncated dierential probability of
addition modular 2 . Based on the ecient computation of dierential probability of addition
n
of the MDS. Finally in Section 4 we present the truncated dierentials that we found by computer
experiments.
addition of 2 , but a straightforward extension to the case of truncated dierentials can still
n
be computationally very expensive. In this section, we study how to further speed up the
round whitening key size cryptanalysis complexity conditions reference
4 w/ any distinguishing attack [K00]
6 w/o 128 impossible dierential 2128 [F99]
6 w/o 192 impossible dierential 2160 [F99]
6 w/o 256 impossible dierential 2192 [F99]
6 w/ 256 impossible dierential 2256 [F99]
8* w/ any dierential attack | > 2020 fraction [MR00]
of the S-boxes
Table 1: Twosh cryptanalysis
K2 K3 input
K0 K1 whitening
S-box 0 K2r+8
PHT <<<1
S-box 1
MDS
S-box 2
S-box 3
S-box 0 1 round
S-box 1
<<<8 MDS
S-box 2
>>>1
S-box 3 K2r+9
: 15 more
rounds
output
K4 K5 K6 K 7 whitening
Figure 1: Twosh
f (x;y) = x + y = z (mod2 ): n
We divide 1x 2 GF(2) into t-bit sub-blocks and denote them by 1x[0 ] ; 1x[1 ]; :: : from the
n t t
1y; 1z)) is given in [M00]. For each triplet (1x; 1y; 1z), the running time of the algorithm is
O(n)1, while a naive approach would require a running time of O(22 ). n
(1 1 1 )=(
x; y; z x; y;z )
where c is the number of pairs (1x; 1y) satisfying the condition (1x; 1y) = (x; y). Let
wH(x) denote the Hamming weight of x. Then it is easy to see that
c = (2 0 1) H( )+ H( ):
t w x w y
have a very large c value. For example, when wH (x) + wH (y) 6, we have c 248. There-
fore, computation of all truncated dierential probabilities using Equation (1) can still be very
expensive, even when the dierential probabilities themselves can be calculated eciently.
1 Later the complexity was further improved to 2(log n) in the worst-case and 2(1) in the average-case.
2.1 Basic idea
The main idea for speeding up the computation of truncated dierential probabilities is to treat
each sub-block somewhat independently. More specically, we will rst compute some properly
dened \partial sums of dierential probabilities" for each sub-block ignoring the carry from
one sub-block to the next, and then we will join these probabilities together to obtain the total
truncated dierential probability for f .
For each sub-block, we need to consider both the dierence in the carryin (denoted by 1cin)
from the previous sub-block and dierence in the carryout (denoted by 1cout) to the next
sub-block.
There are two possible values for 1cin: 0, 1.
Let P1 cout denote the probability that there is carry from one sub-block to the next. That
is,
P1 = Pr[1cout = 1]:
cout
Based on the results in [M00], there are only three possible values for P1 : 0, 0.5, 1. cout
For a give sub-block (the ith sub-block), let (x ;y ; z ) be the values of (x; y; z) re-
i i i
stricted to the sub-block. Below, we dene 6 partial sums for the dierential probabilities, one
corresponding to a possible combination of (1cin;P1 ) = (d;p) for d = 0; 1 and p = 0; 0:5; 1.
cout
=
X
PS(x ; y ;z ; d;p)
i i i
DP(1x[ ] ; 1y [ ]; 1z[ ] ); i
t
(2)
i
t
i
t
Condition PS
where Condition PS is
(1x[ ]; 1y[ ] ; 1z [ ]) = (x ; y ;z );
t
i
t
i i
t
i i i
1cin = d;
P1 = p: cout
PS jj (1; 1; 1; d;p) = [
H L PS (1; 1; 1; 0;p) 2 PS (1; 1; 1;d; 0)
H L
]:
In general, the two sub-blocks H and L can have any number of bits, say t1 and t2 , respec-
tively. Using the above formula, we can compute the new partial sums for the sub-block H jjL
of length (t1 + t2 ) bits.
Computing the total TDP By repetitively joining successive sub-blocks, we can obtain
the 6 partial sums PS(x;y;z; d;p) for the entire block of length n. Since 1cin = 0 for the
least signicant sub-block, 3 of these partial sums (for which d = 1) actually have value zero.
Therefore, the total truncated dierential probability is
TDP (x; y;z) = 1c 2 [
f PS(x; y; z; 0; 0)
+ PS(x; y; z; 0; 1)
+ PS(x; y; z; 0; 0:5)
]:
Eciency analysis The algorithm given in this section is independent of the Hamming weight
of x and y. For n = 32 and t = 8, each of the 212 truncated dierential probabilities can be
computed using a constant number of table lookups, additions, and multiplications. Experiments
show that all the 212 probabilities can be computed in less than one second on a PC.
dierence is 8 with probability 201, c with probability 201 0 208 and 4 with probability 208
(here we have multiple paths, but in most cases the multiple paths join at the next MDS).
For additions with subkeys (i.e., f (x;k) = x + k = z (mod 2 ), where k is some subkey),
n
the value corresponding to k = 0 in our precomputed table gives the truncated dierential
probability when we average over all possible keys. For any xed subkey k, the probability
depends on k, and it can be larger or smaller than the average probability: the maximum
probability can be 1 for a fraction of the subkeys. For easy treatment of probability after the
search, we set the probability to be one for additions with subkeys.
4.1 Truncated dierentials with high probability
First, we searched for truncated dierentials that hold with relatively high probability, although
they may not be exploited in general (well-known) cryptanalytic attacks. As Knudsen [K00]
wrote, such dierentials can provide some bits of nontrivial information in every round.
Our computer experiments found a 12-round truncated dierential with probability of about
2040 9. In Table 3, the output dierence of each round are shown in hexadecimal representation.
:
One can expect to get one good pair following the truncated dierential from about 234 chosen
plaintexts by using a structure in the last byte of the plaintext. There are a total of 294 such
good pairs.
More interestingly, we found a truncated dierential for the full 16 rounds of Twosh with
probability of about 2057 3 (see Table 4). One can expect to get one good pair following the trun-
:
cated dierential from about 2100 chosen plaintexts, and there are 228 such good pairs. In [K00]
Knudsen showed a 16-round truncated dierential with probability 20256 . The probability of
our 16-round truncated dierential is much higher than what was found by Knudsen, and the
total number of good pairs for our dierential is also much larger.
4.2 Truncated dierentials useful for distinguishing attacks
We also searched for truncated dierentials that may be useful in distinguishing attacks. As a
result, we found one 4-round truncated dierential, and four 5-round truncated dierentials (see
Tables 6 and 5). The 4-round truncated dierential is a path included in the 4-round truncated
dierential that Knudsen used for the 2-tests in [K00, Section 5.2]. Note that Knudsen's
4-round truncated dierential contains multiple paths and the probability is much higher.
Knudsen concluded that for more than 4 rounds, it is an open question how nonuniform
the distribution of dierences can be. Now that we found 5-round truncated dierentials with
probability slightly higher than a random permutation, in theory we can perform statistical
tests such as 2 tests. Note that the probabilities in Table 5 can be a little smaller due to 1-bit
rotations or a little larger due to the eect of multiple paths.
round probability
1 0 0 0 1 20 000000
:
1 0 0 0 1 20 000000
:
3 f f f e 208 118785 :
2 0 1 f f 200 028330 :
4 f e f f 208 209239 :
3 f f f e 208 118785 :
5 f f 7 f 2016 299694 :
4 f e f f 208 209239 :
6 7 f f f 2016 390147 :
5 f f 7 f 2016 299694 :
7 f f b f 2024 480603 :
6 7 f f f 2016 390147 :
8 b f f f 2024 571056 :
7 f f b f 2024 480603 :
9 f f 7 f 2032 661511 :
8 b f f f 2024 571056 :
10 7 f f f 2032 751965 :
9 f f 7 f 2032 661511 :
11 f f b f 2040 842420 :
10 7 f f f 2032 751965 :
12 b f f f 2040 932874 :
11 f f b f 2040 842420 :
13 f f 7 f 2049 023329 :
12 b f f f 2040 932874 :
14 7 f f f 2049 113783 :
15 f f b f 2057 204238 :
truncated dierentials which can be useful in distinguishing Twosh reduced to 5 rounds from
a random permutation. We will implement some tests to conrm our conjecture.
References
[C99] http://www.counterpane.com/twofish-products.html
[F99] N. Ferguson, \Impossible dierentials in Twosh," Twosh Technical Report #5,
October 5, 1999. http://www.counterpane.com/twofish-impossible.html
[K00] L. R. Knudsen, \Trawling Twosh (revisited)," Presentation at rump session of
AES3. http://csrc.nist.gov/encryption/aes/round2/conf3/aes3agenda.h-
tml, Public comment on AES Candidate Algorithms { Round 2. http://
csrc.nist.gov/encryption/aes/round2/comments/20000515-lknudsen-2.pdf
[K95] L. R. Knudsen, \Truncated and Higher Order Dierentials," Fast Software Encryp-
tion | Second International Workshop, Lecture Notes in Computer Science 1008,
pp.196{211, Springer-Verlag, 1995.
[KN96] L. R. Knudsen and T. A. Berson, \Truncated dierentials of SAFER," Fast Soft-
ware Encryption, | 3rd International Workshop, Lecture Notes in Computer Sci-
ence 1039, pp.15{26, Springer-Verlag, 1996.
[KRW99] L. R. Knudsen, M. J. B. Robshaw, and D. Wagner, \Truncated Dierentials and
Skipjack," Advances in Cryptology | CRYPTO'99, Lecture Notes in Computer
Science 1666, pp.165{180, Springer-Verlag, 1999.
[M00] S. Moriai,\Cryptanalysis of Twosh (I)", In Proceedings of the 2000 Symposium
on Cryptography and Information Security, Okinawa, Japan, January 26-28, 2000.
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 :
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 :