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.

Unlike the encoding function strip encoding we have used so far, the functionbinary encoding is information-preserving, taking 8-bit ASCII input and returning thebinary encoding string. The inverse function binary decoding recovers the original text.A linear feedback shift register cryptosystem is created in SAGE using the functionLFSRCryptosystem, taking no arguments. A key is defined by means of a pair, consistingof the connection polynomial g(x) over F 2 and a initial bit sequence of length equal to thedegree of the sequence. A sample use of the cryptosystem follows. The shrinking generatorcryptosystem is a cryptosystem based on a pair of LFSR’s as defined in class.sage: F2 = FiniteField(2)sage: P2. = PolynomialRing(F2)sage: g = x^17 + x^5 + 1sage: IS = [ F2.random_element() for i in range(17) ]sage: LFSR = LFSRCryptosystem()sage: PT = LFSR.encoding("The dog ate my assignment."); PT0101010001101000011001010010000001100100011011110110011100100000011000010111010001100101001000000110110101111001001000000110000101110011011100110110100101100111011011100110110101100101011011100111010000101110sage: K = (g,IS)sage: e = LFSR(K)sage: CT = e(PT)sage: PT == e(CT)TrueNote that the encoding of the message is not ciphertext – this is the standard ASCII bitencoding.Exercise 6.7 Consider the coefficient sequence for f(x)/g(x) in F 2 [[x]], where g(x) =1 + x + x 4 and f(x) = 1 + x 3 . Is g(x) an irreducible polynomial? A primitive polynomial?Draw the associated linear feedback shift register. What is the initial state of the shiftregister?Solution. The polynomial x 4 + x + 1 is an irreducible polynomial, which is primitive. TheLFSR with this connection polynomial was given in the previous tutorial. The primitivityfollows since none of the sequences, computed last week, had a period shorter than 15.The initial state corresponding to the polynomial f(x) = x 3 +1 was the second given value1110 of the previous tutorial.Exercise 6.8 Compute the linear complexity of the sequences 11, 1011, 10101, 10110, and10011.119

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

Saved successfully!

Ooh no, something went wrong!