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.

which holds since −4 = 17 + (−1) ∗ 21, or23 + 19 = 437 = 17,where the latter identity is determined by 437 = 17 + 420 = 17 + 20 ∗ 21.7.2 The mod operatorIn both rings R = Z and R = F 2 [x], we have an operator mod m for producing a canonicalsmallest representative for elements of the quotient rings R/mR. This means that we canwork with this smallest or reduced representative in computations in R/mR. In particular,we note that working with this representative is well-defined:((a mod m) + (b mod m)) mod m = (a + b) mod m((a mod m) ∗ (b mod m)) mod m = (a ∗ b) mod msince, a mod m = b mod m if and only if a = b.The value a mod m can be computed by long division — successively subtracting offmultiples until the result is smaller, until the final result is smaller than m. The definitionof x smaller than y is x < y for positive x, y in Z, and deg(x) < deg(y) for polynomialsx, y in F 2 [x].Definition 7.2 Using the mod operator we define a boolean operator ≡ mod m suchthat the value a ≡ b mod m is True if and only if (a − b) mod m is zero.Example 7.3 We use the operator mod to determine a canonical representative for x 7 inF 2 [x]/(x 2 + x + 1). First we write x 7 = (x 3 ) 2 ∗ x, and compute:x 3 mod (x 2 + x + 1)= (x 3 + x ∗ (x 2 + x + 1)) mod (x 2 + x + 1)= (x 2 + x) mod (x 2 + x + 1)= ((x 2 + x) + (x 2 + x + 1)) mod (x 2 + x + 1) = 1.It follows that x 7 mod x 2 + x + 1 = (1 2 ∗ x) mod (x 2 + x + 1) = x. By explicit long division:x 5 + x 4 +x 2 + x + 1 ) x 7x 7 + x 6 + x 5x 6 + x 5x 6 + x 5 + x 4x 2 + xx 4x 4 + x 3 + x 2x 3 + x 2x 3 + x 2 + xx60 Chapter 7. Elementary Number Theory

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

Saved successfully!

Ooh no, something went wrong!