Improving Keystream Generation for Sosemanuk Stream Cipher Using Twofish Block Cipher

This paper will introduce t wo p roposal algo rithms (Snowfish 1) and th e (Snowfish 2) to improve the Sosemanuk stream cipher algorithm by benefiting from the efficient properties of the Twofish block cipher and also use its key schedule, key-dependent Sbox to increase the se curity, randomness and try to avoid the guess and determine attac k of Sosemanuk. These two proposals u se Twofish algo rithm rather than Serpent algorithm which was used in the Sosemanuk a nd also they use key-dependent Sbox rather than static Sbox. They are similar in the same key length (128 to 256 bit), IV length (128 b it), LFSR length, FSM functions a nd output transformation. In this paper will make a comparison between Snowfish 1 , Snowfish 2 and Sosemanuk algorithms by using the tests of randomness, the structural tests and the complexity of the a lgorithm. These tests give results that show the two proposed algorithms h ave goo d results in increasing the se curity and ran domness compared with Sosemanuk algorithm.

). Sbox256 uses two keys rather than the use of four keys as in s-boxes of Twofish's round function; also the Sbox256 outputs 128 bit after performing q-permutation operations and two XOR operations as shown in Figure (2), then it can produce four words by the following equations (2) where each i t f + is 32 bit: • Choice of the block cipher.
The block cipher used in the IV setup is derived from Twofish for the following reasons compared with other AES block ciphers [2, 3]: 1. Performance as a function of key length 2. Software performance 3. Key setup plus encryption 4. Randomness.
PDF created with pdfFactory Pro trial version www.pdffactory.com

Design of Twofish16 :
Since there is no attack of differential and linear on Twofish thus the output of three rounds is chosen freely; and then the outputs of round 8 th (4 th cycle), 12 th (6 th cycle), and 16 th (8 th cycle) are chosen based on Twofish's cycles to increase the security point.

Key Initialization and IV Injection
Snowfish needs key initialization process and IV injection of Twofish block cipher: • Key Schedule The key setup corresponds to the Twofish16's key schedule which is the same as the twofish's key schedule, which produces 40 32-bit subkeys rather than 100 32-bit in serpent24.Note that it is known previously that Twofish's key schedule produces at first 8 words subkey for whitening step and then produces 32 words subkey for round function step.Twofish accepts any key length from 128 bits to 256 bits; hence, Snowfish may work with exactly the same keys.

• IV Injection
The IV is a 128-bit value.It is used as input to the twofish16 block cipher, and operates in the same time with the key schedule by using round subkeys.Twofish16 consists of 16 rounds and the outputs of the 8 th , 12 th and 16 th rounds are used.The outputs are denoted as follows:

• In case Sbox256
The Sbox256 is performing after four loops in each time.

The Algorithm of snowfish stream
cipher This section will introduce the algorithm of the two proposals which have similar design of the input, key schedule phase, IV injection phase and encryption or decryption phase but they are different in keystream generation phase depending on the used Sbox.The figure (5) shows a flowchart of the algorithm in case keystream generation phase by using Sbox128 and figure (6) shows a flowchart of algorithm in case keystream generation phase by using Sbox256: Input : • The key with length (128 to 256 bits).• The IV with length (128 bits).
• Plaintext or ciphertext output : • The keystream with length 128 bits for each time of period.

Key schedule phase:
Step1

Strengths and Advantages of Snowfish
The design of new synchronous stream cipher Snowfish is based on the Sosemanuk design and on the improvements of it.The strengths and advantages are from the following security points of view: • Snowfish makes the high nonlinear correlation between the initial states also it avoids some potential weaknesses as the guess and determine attack proposed in [4]

Apply Statistical Tests on the Keystream Bits
In this paper, the two statistical tests are applied to the generated keystream and these tests are the randomness test and the structural test.
PDF created with pdfFactory Pro trial version www.pdffactory.com1982

The Randomness Tests
The randomness property of the stream cipher system is analyzed by using the statistical tests: Frequency, Serial, Poker, Runs and Autocorrelation tests.Different key sizes are used in these tests.The following section shows the results of test for three systems when different keys in size between 256 and 128 bit are applied with time from 1 to 10.The results show that the two proposals are more random than Sosemanuk cipher when they have values smaller and near to chi-square for each test and have less fail status in most results.Also they show that the proposal 2 is better than proposal 1 as shown in tables (1, 2, 3, 4, 5 and 6) because it has Sbox256 with more qpermutations and two key dependent sbox.
The following two examples are applied and the tables of each one show the results of randomness test on the result keystream with length (n) 128, 256 and 512 bits.Of these examples are: Example 1 : Key : " the university of technology " IV : "computersecurity" Example 2 : Key : "informationsec " IV : "computersecurity"

The Structural Tests
The structural property of the stream cipher system is analyzed by using the  7) shows that the time of two proposed system has the same range of time compared to with the Sosemanuk such that the two proposals have efficiency in the speed.Note that this time is computed from begin to end of algorithm.

Measuring the Complexity
The strength of a cipher is determined by the computational complexity of the algorithms used to solve the cipher.The strength of an algorithm is measured by O(n) which means computing time of linear form.Table (7) shows the results of computing time of two proposed system with Sosemanuk of the keystream generation phase only of algorithm.The result shows that the complexity of the proposed 1 increased by 4 and of the proposed 2 decreased by 2 compared with the keystream generation phase in sosemanuk.
PDF created with pdfFactory Pro trial version www.pdffactory.com each round consists of the four 32-bit.These values are used to initialize the Snowfish internal states with the following values as the equations (3) and see Figure (3) of the proposed 1 and (4) of the proposed 2:4.Output TransformationThe output transformation process in Snowfish is similar to Sosemanuk by using the XOR operation between the output of LFSR and s-box.But the difference is in the use of s-box with its inputs and outputs, this cause an influence on output transformation process:• In case Sbox128The Sbox128 operates four loops in each time.In each time the four words outputs

Figure
Figure (3) shows an overview of Snowfish 1. • In case Sbox256The Sbox256 is performing after four loops in each time.The four words

•
In case encryption : plaintext ⊕ keystream = ciphertext • In case decryption : ciphertext ⊕ keystream = plaintext † Using ten times is enough for test vector End phase 1989

‫ﺍﻟﺘﺴﻠﺴﻠﻲ‬ ‫ﻟﻠﺘﺸﻔﻴﺭ‬ ‫ﺍﻟﻤﻔﺘﺎﺡ‬ ‫ﺴﻠﺴﻠﺔ‬ ‫ﻤﻭﻟﺩ‬ ‫ﺘﺤﺴﻴﻥ‬ Sosemanuk ‫ﺒﺄﺴﺘﺨﺩﺍﻡ‬ ‫ﺍﻟﻜﺘﻠﻲ‬ ‫ﺘﺸﻔﻴﺭ‬ Twofish
The four words which output from the Sbox256 are grouped and then are combined by XOR with the PDF created with pdfFactory Pro trial version www.pdffactory.com t f

Keystream generation phase: ü In case sbox128 (proposal 1) : Step1: Repeat ten
* times ( t ) * Using ten times is enough for test vector PDF created with pdfFactory Pro trial version www.pdffactory.com due to the particular use of