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.

Exercise 6.11 Since the LFSR is the bitsum of the binary keystream, generated by theconnection polynomial and initial state, why must the inverse key be equal to the key itself?Solution. Since LFSR ciphertext is the bitsum of plaintext with a keystream, a subsequentbitsum with the same keystream gives the original plaintext:c i + s i = (m i + s i ) + s i = m i + (s i + s i ) = m i + 0 = m i ,Therefore enciphering map is equal to deciphering map; in particular, the enciphering anddeciphering keys are the same.Elementary Number TheoryReduction modulo a polynomial g(x) or modulo an integer m plays a central role in themathematics of cryptography. Recall that for a monic polynomial g(x) of positive degree,we define a(x) mod g(x) to the unique polynomial a 0 (x) with deg a 0 (x) < deg g(x) suchthata(x) = a 0 (x) + a 1 (x)g(x).For an integer m, we define a mod m to be the unique integer a 0 with 0 ≤ a 0 < m suchthat a = a 0 + a 1 m.Fermat’s little theorem. If p is a prime, then the relation a p−1 ≡ 1 mod p holds for anyinteger a not divisible by p.Note. The SAGE function mod operates on integers, with the syntax:sage: m = 101sage: (2^31).mod(m)34The same mathematical result can be achieved with the powermod function (for modularpowering):sage: 2.powermod(31,m)34The latter construction, however, is more efficient.Chinese remainder theorem. Let p and q be distinct primes, then for every integera and b there exists a unique integer c with 0 ≤ c < pq such that c ≡ a mod p andc ≡ b mod q.121

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

Saved successfully!

Ooh no, something went wrong!