Enhancement of Non-Linear Generators and Calculate the Randomness Test for Autocorrelation Property

In this paper, three main generators are discussed: Linear generator, Geffe generator and Bruer generator. The Geffe and Bruer generators are improved and then calculate the Autocorrelation postulate of randomness test for each generator and compare the obtained result. These properties can be measured deterministically and then compared to statistical expectations using a chi-square test.


Introduction
Cryptographic ciphers classified in two types: symmetric cipher and asymmetric cipher. The symmetric ciphers are moreover divided into stream cipher and block cipher. Block cipher works on big blocks at the same time (usually becomes 128 or 256 bits) and there is no internal state used (at least not used in fundamental version). A stream cipher deals with single bits or single words and needs to keep up an internal state to change the cipher at each move. In general, stream cipher faster than block cipher [1].
The stream cipher is used in many applications in every day (for instance RC4 is used in secure wireless networks and A5 is used in mobile telephones) [1].
In 1976 Professor Solomon W. Golomb had written a book that is an excellent introduction to the theory of shift registers. Ron Rivest, Adi Shamir and Leonard Adleman; in 1987 made a design of a byte-oriented stream cipher called RC4. This kind of cipher found its application in many application security protocols and internet. Moshe Sipper and Marco Tomassini in 1996 published a paper about how to generating a parallel random number by using cellular programming [2]. Cunsheng Ding and Tor Helleseth in 1999 published a paper about describe several classes of the binary sequences with three-level autocorrelation [3].

ISSN: 0067-2904
Alsaadi and Al-Shammari Iraqi Journal of Science, 2019, Vol.60, No.10, pp: 2229-2236 2230 In 2005 Laszlo Hars and Cortlandt Manor invented a system and method for testing the random numbers generated called the autocorrelation test to determine if the generated random numbers have enough randomness [4]. Yassir Nawaz and Guang Gong in 2008 wrote a paper about how to design a family of stream ciphers which generate a key stream with excellent two-level autocorrelation and the design also contained other randomness properties [5]. Faez H. A. et al., in 2010 published a paper in which that the Golomb's postulates and the binary standard randomness tests are generalized to be suitable to be applied on digital sequences [6]. Benny Y. Zhang and Guang Gong in 2013 published a paper that studied the randomness properties of synchronous stream ciphers that used in wireless communications [7]. Faez et al., in 2017, introduce an attack by employing some weak points in classical stream cipher using Bees algorithm [8].
Ayad G. N. and Amer Abdul Majeed in 2014 published a paper that studied one of basic randomness runs property for stream cipher, it can be determined for any key generator before it is constructed [9]. Abdullah A. G. and Faez H. A. in 2018 published a paper that introduced a new technique in stream cipher based on a dynamic algorithm [10].

Stream Cipher Based on Feedback Shift Register
A feedback shift register (FSR) is a consisting of two main parts: shifts register (SR) and its feedback function. The SR is a sequence of bits. Each time only one bit is needed, all the bits in the SR are moved one bit to the right. The feedback function (polynomial) is simply the XOR mixed the registers. An FSR is called linear if the connection logic is a linear function on that is, if it is of the form ( ) … (1) For some fixed constants Otherwise, it is called non-linear. Here, the values of are either 0 or 1, and hence the sequence is said to be over a binary alphabet, which is usually denoted as , and for all . The operation ⊕ can easily be performing as exclusive-OR and as operation both using digital logic gates. In the rest of this paper, we will simply use addition and multiplication (mod ), respectively, for these operations. Over this binary alphabet, therefore, one can add and multiply two elements, and the subtraction is the same as addition. There is just a single nonzero element (which is ) and the division by is the same as the multiplication by [11,12]. The simplest form for the FSR is a linear feedback shift register (LFSR) as show in Figure-

Properties of Pseudo-random Numbers
Before actual algorithms are considered and attempt to evaluate the efficiency of each for cryptographic purposes, it is important that understanding what that are looking for in a cryptographic algorithm [13]. Any good Pseudo-random Numbers Generate will generate a sequence of numbers that have the following properties:

The Linear complexity
The linear complexity of a finite binary sequence is the length of the shortest LFSR that generates a sequence having as its first terms and denoted by ( ) and can by calculated by using Algorithm of Berlekamp-Massey [14].

The Periodicity
Let the ( ) represents the period of sequence generate from the LFSR system, and let ( ) refers to the period of each sequence generated from for each . Where is the number of registers, if ( ) ( j ); where is the lengths of ; so the periodicity equal to [15]: . … (2) Where N is the number of combined LFSR's in the cryptosystem.

Correlation Immunity
It's a relation between the output sequence of Combining Function Unit ( ) from the Key Generate ( ) and the sequences that are combined with each other by . This relation occurred because of the high nonlinearity of the . In general the correlation probability ( ), which is the ratio between the number of similar binaries ( ) of two sequences to the length ( ) of the part compared of them.
… (3) The correlation immune order can be calculated from the logical truth table for depending on computing correlation probability ( ). For any system the best result of the correlation immunity when (where is the numbers of immunity ); that is mean for all , are statically independent from the output [10].

Randomness
A random bit generator is a device or an algorithm which it is produced a sequence (of bits) is a statistically independent and unbiased binary digit. In this subsection, Five statistical tests are presented that are commonly used for deciding whether the binary sequence ( ) have some specific properties that a truly random sequence. If a sequence passes all five tests, then there is no ensuring that it was indeed produced by a random bit generator. The run, frequency and auto correlation test are called the Main Binary Standard Randomness Tests [16]. Before shedding light on the five basic tests, have to construct the law of Chi-square which is used really.
Assume that the outcome of a random experiment falls into one of k categories, and assume by hypothesis that p i is the probability that the outcome falls into category i, assume that L independent observation is made, and let Q i be the number of observation falling into category i, in order to test the hypothesis the quantity T is compared [17]: ∑ ( )

a) Frequency Test
Frequency test is used to calculate wither the number of 's and 's in a sequence (key stream sequence) with length are: Where are denoted the number of 's and 's in sequence respectively. The expected value is ⁄ , is the length of with freedom degree , 1 ( 1)

b) Run Test
A run of sequence is a subsequence of consisting of consecutive 's or 's run of 's called Block while run of 's called Gap his run test use to calculate whether the number of runs of various lengths in the sequence is as expected for a random sequence Where equal to the largest block or gap, be the observed number of gaps and blocks respectively of length in for each . And The expected value equal to ( ) ⁄ , is the length of sequence , ( ).

c) Serial Test
The purpose of this test is to determine whether that the numbers of occurrences of 11, 10, 01 and 00 as a subsequence are approximately the same as would be expected for random sequence ∑ ∑ ( )

d) Poker Test
The purpose of the poker test is to determine whether the sequence of length each appears approximately the same number of times in as would be expected for the random sequence. This test work by dividing the into parts with length and let be the observed number of occurrence of the kind of sequence of length .

e) Autocorrelation Test
The purpose of this test is to calculate if there correlations between the sequence and (non-cyclic) shifted reversions of it. Let is a number of shifting be a fixed integer ⁄ .

… (9)
Where ( ) and ( ) refer to the observed of 's and 's in shifted respectively, ( )

Key Management
To increase the security of the cryptosystem, two kinds of keys are used. These keys are considered as initial LFSRs of the cryptosystem and they are as follows:

Message Key ( ):
This key is a being send in an encrypted message and will be inserted on some position of the encrypted message upon between the sender and the receiver. It is consists of ( ) characters of ASCII CODE ( bits/character). A new can be used with every new message to ensure that no two messages have the same initial key.

Basic Key ( ):
This key is very important for the security of the cryptosystem and this key must be changed daily. It is consists of ( ) characters of ASCII CODE ( bits/character).

Basic Components for cryptosystems
The system consists of the following main components:

i. Basic LFSR's of the cryptosystem
Three basic LFSRs are used: a) SR1 with length have a characteristic polynomial: . b) SR2 with length have a characteristic polynomial: . c) SR3 with length have a characteristic polynomial: .

ii. Enhancement Balance Feedback Shift Register
Balance (to ovoid the correlation) SR with length have a characteristic polynomial: .

iii. Feedback functions combining SR
Three combining functions are used, they are as follows: a) Linear generator that combining function is: The basic components and moving for the proposed cryptosystem are shown in Figure-2.

Figure 2-
The basic components and moving for the proposed cryptosystem.

Initialization of the LFSRs
The main steps of system initialization are: 1-Every character of transformed into bits to obtain string of bits with total length bits.
Where are the bits of , and . 2-Every character of transformed into bits of binary number then the string of becomes has total length bits.
Where are the bits of , and . 3. The initial of string shift registers is the result of sum between and (without carry) such that: , Where which the string used to fill the (3) LFSR' of the cryptosystem. 4. To complete the initialization process, from string the LFSRs of the cryptosystem are filled one after one as following: a) SR1 with length bit filled from to . b) SR2 with length bit filled from to . c) SR3 with length bit filled from to . For each SR the last stage filled with one (to ovoid zero sequence). 7. Encryption and Decryption Process For Encryption process, the plaintext characters are converted to L bits (P i ) then xored with output key (K i ) of the proposed cryptosystem to obtain the ciphertext bits (C i ) using equation (15): C i = P i xor K i … (15) Then the C i are re-converted to ciphertext characters. While in the decryption process, the ciphertext characters are converted to L bits (C i ) then xored with output key (K i ) of the proposed cryptosystem to obtain the plaintext bits (P i ) using equation (16): P i = C i xor K i … (16) Then the P i are re-converted to plaintext characters.

Alsaadi and Al-Shammari
Iraqi Journal of Science, 2019, Vol.60, No.10, pp: 2229-2236 2234 The main algorithm of the proposed cryptosystem is as follows: For the output key (Ki) of the proposed cryptosystem, the autocorrelation randomness test can be applied.

Test the Results of Proposed Cryptosystem
Example (1): Four samples of keys with different length (L=1000, 5000, 10000 and 50000 bits) are generated from the proposed cryptosystem to calculate the autocorrelation randomness test for these keys and compare the results with distributed chi-square ( ), such that is the significance level with 0.05 and freedom degree ( ) which is used in the table of chi-square. Tables-(1, 2, 3 and 4) are showing the test results, where P refers to pass the test and F refers to fail in the test. OUTPUT: The output key bits (key sequence) and ciphertext (plaintext).
Step 1: mixing and to initialize string for shift registers.
Step 2: fill the shift registers one after one.
Step 3: for to the length of key do steps 4-7 Step 4: for to do step 5 Step 5: tapping the feedback shift registers to generate a sequence.
Step 6: set key is the combining functions (Linear, Bruer, Geffe) between the three registers.
Step 7: Enhancement of the key generated (Bruer, Geffe) by mixing the key generated with the balance shift register by using XOR combining to obtain (Ki).

Conclusions
Notice that from the above example some important results that are summarize: 1. The autocorrelation is very important test, since it can be transformed to frequency when =0, and to Poker test when =0 and k=1 (k is the length of tested string of S).