Mustansiriyah University Engineering College Computer Engineering Dep Classical

  • Slides: 3
Download presentation
Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year

Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year Course name: Data Encryption Lecturer: Fatimah Al-Ubaidy Modular Arithmetic Ø The division algorithm: Given any positive integer n and any nonnegative integer a, if we divide a by n, we get an integer quotient q and an integer remainder r that obey the following relationship: a=qn+r 0 r < n ; q = a / n where x is the largest integer less than or equal to x. e. g. Let a = 7 and n = 3, then 7 = 2 3 + 1. Here, q = 2 and r = 1, Let a = 10 and n = 2, then 10 = 5 2 + 0. Here, q = 5 and r = 0, Let a = -11 and n = 7, then -11 = (-2) 7 + 3. Here, q = -2 and r = 3. Ø The Modulus: If a is an integer and n is a positive integer, we define a mod n to be the remainder when a is divided by n. The integer n is called the modulus. Thus, for any integer a, we can rewrite the previous equation as follows: a=qn+r 0 r < n ; q = a / n a = a/n + (a mod n) e. g. 11 mod 7 = 4, - 4 mod 8 = 4, 9 mod 2 = 1, -11 mod 8 = 5 1

Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year

Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year Course name: Data Encryption Lecturer: Fatimah Al-Ubaidy Modular Arithmetic Ø Modular arithmetic operations: The (mod n) operation maps all integers into the set of integers {0, 1, … , (n -1)}. The Modular arithmetic exhibits the following properties: Examples: (11 + 15) mod 8 = 26 mod 8 = 2 [(11 mod 8) + (15 mod 8)] mod 8 = [3 + 7] mod 8 = 10 mod 8 = 2 (11 - 15) mod 8 = - 4 mod 8 = 4 [(11 mod 8) - (15 mod 8)] mod 8 = [3 - 7] mod 8 = - 4 mod 8 = 4 (11 15) mod 8 = 165 mod 8 = 5 [(11 mod 8) (15 mod 8)] mod 8 = [3 7] mod 8 = 21 mod 8 = 5 Now, suppose we wish to calculate x 11 mod n for some integers x and n. Observe that x 11 = x 1+2+8 = (x)(x 2)(x 8). 2

Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year

Mustansiriyah University Engineering College Computer Engineering Dep. Classical Cryptography Modular Arithmetic Class: Third Year Course name: Data Encryption Lecturer: Fatimah Al-Ubaidy Modular Arithmetic Exponentiation is performed by repeated multiplication. For example, to calculate x 11 mod n for some integers x and n. Observe that x 11 = x 1+2+8 = (x)(x 2)(x 8). Ø Congruent Modulo: Two integers a and b are said to be congruent modulo n, if (a mod n) = (b mod n). This is written as a b (mod n). If n|(a - b), then (a – b) = k n for some k. a can be written as (a = b + k n). 3