11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LFSR Cryptosystems We introduce new utilities for binary stream cryptosystems basedon linear feedback shift registers. The functions binary encoding and binary decodingconvert ASCII text into its bit sequence and back. In addition, the new binary cryptosystemsare:LFSRCryptosystemShrinkingGeneratorCryptosystemUnlike 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?Exercise 6.8 Compute the linear complexity of the sequences 11, 1011, 10101, 10110, and10011.Linear Complexity 57

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

Saved successfully!

Ooh no, something went wrong!