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.

If a, b, and c are as above, then for any integral polynomial f(x), the integer f(c) satisfiesf(c) ≡ f(a) mod p and f(c) ≡ f(b) mod q. Therefore f(c) mod pq is the unique solutionto the Chinese remainder theorem.Analogues of Fermat’s little theorem also hold for polynomials.Polynomial analogue of Fermat. If g(x) is an irreducible polynomial of degree n overF 2 , then the relation a(x) 2n −1 ≡ 1 mod g(x) holds for any polynomial a(x) not divisibleby g(x).Chinese remainder theorem. Let g(x) and h(x) be monic polynomials with no commonfactors. Given any polynomials a(x) and b(x), there exists a unique polynomial c(x) suchthat c(x) ≡ a(x) mod g(x) and c(x) ≡ b(x) mod h(x).We can create and work with polynomials over F 2 as demonstrated by the followingSAGE code.sage: F2 = FiniteField(2)sage: P2. = PolynomialRing(F2)sage: f = x^17 + x^5 + 1sage: f.factor()x^17 + x^5 + 1sage: g = x^13 + x^5 + 1sage: g.factor()(x^2 + x + 1) * (x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^3 + x + 1)Exercise 7.1 Let p be the prime 2 31 − 1 = 2147483647. Use the SAGE function powermodto verify Fermat’s little theorem for several values of a. Why would it be a bad idea tocompute a p−1 and then reduce modulo p?Exercise 7.2 Let p be as above and let q = (2 61 + 1)/3 = 768614336404564651. Computea p−1 mod pq for various primes using powermod. Then reduce the result modulo p. Howdo you explain the result in terms of the Chinese remainder theorem and Fermat’s littletheorem?Exercise 7.3 Let g(x) = x 17 + x 5 + 1, and use the function powermod to verify the polynomialanalogue of Fermat’s little theorem for the polynomials x, x 2 + x + 1, etc.Exercise 7.4 Let h(x) = x 17 + x 15 + x 10 + x 5 + 1 and compute a(x) 217 −1 mod g(x)h(x) forvarious a(x). What is the result reduced modulo g(x)? Why does the same not hold truefor a(x) 217 −1 mod g(x)h(x), reduced modulo h(x)?Primes and Irreducibles 65

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

Saved successfully!

Ooh no, something went wrong!