11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Solution. The linear complexity of the sequences 11, 1011, 10101, 10110, and 10011 is 1,2, 2, 2, and 3. The initial values follow from extending the sequences with period 1, 3, 2,and 3, with connection polynomials x + 1, x 2 + x + 1, x 2 + 1, and x 2 + x + 1. The thirdsequence can be extended to a sequence with period no better than 4, so it generated byno LFSR of length 2. A possible connection polynomial is x 4 +1 = (x+1) 4 , giving a LFSRof length 4 which generates it. However, the divisor x 3 + x 2 + x + 1 = (x + 1) 3 defines arecursion for a LFSR of length 3. Hence the linear complexity for this sequence is 3.Exercise 6.9 Compute the first 8 terms of the linear complexity profile of the coefficientsequence from Exercise 1.Solution. The first 8 terms of the linear complexity profile for the sequence of the firstquestion are:[1, 1, 1, 3, 3, 3, 4, 4].On the other hand, since the sequence is generated by a LFSR of length 4 we know thatthe full infinite sequence becomes constant at 4.Exercise 6.10 Practice encoding and enciphering with the LFSR stream cryptosystem.The function binary decoding easily converts this back to ASCII text. Use these functionsto verify that PT is just the binary encoding of the original plaintext message and that theciphertext is enciphered.Solution. The encoding and decoding member functions associated with a LFSR are justa wrapper around binary encoding and binary decoding:sage: LFSR = LFSRCryptosystem()sage: PT = LFSR.encoding(’The dog ate my assignment.’); PT0101010001101000011001010010000001100100011011110110011100100000011000010111010001100101001000000110110101111001001000000110000101110011011100110110100101100111011011100110110101100101011011100111010000101110sage: LFSR.decoding(PT)’The dog ate my assignment.’We verify using that binary decoding that the binary string also returns the ASCIImessage:sage: PT.binary_decoding()’The dog ate my assignment.’120 Appendix C. Solutions to Exercises

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!