Lec 8 : Data Security Stream Cipher Systems 1 3.4 STREAM CIPHER: Recall the discussion in Sections 3.1, 3.2 and 3.3 concerning the One-Time-Pad system, the development of stream cipher systems was greatly influenced by the fact that Shanoon had proved the OTP to be unconditionally secure. Stream cipher systems are developed to emulate the OTP system in the sense that they produced long sequence of displacement which were applied character by character to the plaintext message as illustrated in figure 3-1. However, the fundamental difference is that; the sequences generated by the stream system is not random, and it is completely determined by a key. Thus, a stream cipher is a system in which the key is fed to an algorithm, which uses the key to generate finite sequence. The algorithm is usually referred to as the sequence generator or key stream generator. Figure 3-2 illustrates stream cipher system. Stream Ciphers lies between simple XOR and One-Time Pad. Encryption and decryption processes are shown in figure 3-3. K M=C C K=M K K=M K 0 =k and K K K =0 Key Generator Key stream Ciphertext Mixer Plaintext Figure (3-2)Stream cipher System. Ki Mi Ki Ci Mi Stream ciphers should posses the following characteristics: Figure (3-3) Stream Cipher encryption and decryption. Lec 8 : Data Security Stream Cipher Systems 2 1. Easy to implement. 2. High speed in generating key stream. 3. Computationally secure. 3.1. It should be protected against known-plaintext attack. 3.2. Having a large key space. 3.3. The period of the key sequence should be greater than the message length. 3.4. Key sequence has random characteristics. In the following sections, fundamental background and techniques of stream cipher systems is discussed. A survey of previous stream ciphers cryptanalysis also discussed. 3.5 KEYSTREAM GENERATOR: The basic element in stream ciphers is the key stream generator, which will generate the key stream (sequence) to be combined with the plaintext stream and produce the cipher text. 3.5.1 LINEAR SHIFT REGISTERES: A feed back shift register is an implementation of the key stream generator. It is made up of two parts; a shift register and a feedback function. The shift register is a sequence of bits. Each time a bit is needed, all the bits in the register are shifted 1 bit to the right. The new left-most bit is computed as a function of the other bits in the register. The output of the shift register is one bit. The simplest kind of feedback shift register is a linear feedback shift register (LFSR). The feedback function is simply the XOR function. Figure 3-4 shows a 4-bit LFSR. If it is initialized with the value (1111), it produces the following output sequence: 111101011001000 ...... b4 b3 b2 b1 Figure 3-4 Linear Feedback Shift Register (4-bit LFSR) Lec 8 : Data Security Stream Cipher Systems 3 Three parameters; initial state, primitive polynomial, and the length of the register affect the output stream of the linear shift register. For each linear shift register there exist a linear equivalence, which defined as; the length of the smallest linear shift register which can be used to generate the sequence. 3.5.2 REGISTER STAGES: Shift registers consist of finite length of binary memory, called stages, for n-binary memory, called m-stages shift register, and in any given time the contents of the register, called state. The register could be in one of 2 m states. Zero state is ignored because; it causes endless sequence of zeros. Thus, we left with 2m -1 states. Next states depends on the feedback function (the mixer). Example: Given a LFSN of figure 3-4 with an initial state (0001) the register will cycle with the following states and produce the corresponding outputs. Feedback R states Out put 1 0001 1 1 1000 0 1 1100 0 1 1110 0 1 1111 1 0 1 0 1 1 0 0 1 0 0 0111 1011 0101 1010 1101 0110 0011 1001 0100 0010 1 1 1 0 1 0 1 1 0 0 To achieve maximal length of 2m -1 stages of LFSR; the tap sequence must cause the register to cycle through 2m -1 non zero bit sequence before repeating; this Lec 8 : Data Security Stream Cipher Systems 4 will happen if the polynomial formed from the elements in the tap sequence is primitive. 3.5.3 PRIMITIVE POLYNOMIAL When talking about the polynomials, the term prime is replaced by irreducible. Primitive polynomial of degree n is defined as an irreducible polynomial that divides x2d-1 + 1, but not xd +1 for any d that divides 2n -1. A polynomial is irreducible if it can not be expressed as the product of two other polynomials (except 1 and itself). In another meaning maximal length sequence with period 2n -1 are generated only in the case when the characteristic (generating) polynomial ¢(x) is primitive, irreducible, and the initial state of the register must be other than zero. Table 3-1 illustrates primitive polynomial of m =2 - 6. Degree 2 3 Primitive polynomial X2+x+l X3+x+l Degree Primitive polynomial 6 X6+x+1 X6+x5+l x3+x2+l X6+x5+x4+x+l 4 X4+x+l x6+x5+x4+x+l x6+x5+x3+x2+ x+l 5 x4+x3+l X5+x2+1 . X5+x2+1 x6+x4+x3+x+l X5+x4+x3+x2+l X5+x3+x2+ x+1 X5+x4+x3+x+l Table 3-1 Primitive polynomials x5+x4+x3+x+l