Properties of Arithmetic Reference Pfleeger Charles P Security

  • Slides: 13
Download presentation
Properties of Arithmetic Reference: Pfleeger, Charles P. , Security in Computing, 2 nd Edition,

Properties of Arithmetic Reference: Pfleeger, Charles P. , Security in Computing, 2 nd Edition, Prentice Hall, 1996. Ref: Pfleeger 96, Ch. 3 1

Identity and Inverses • Let “ ” denote an operation on numbers. • A

Identity and Inverses • Let “ ” denote an operation on numbers. • A number i is called an identity for operation “ ” if x i = x and i x = x for every number x. • The number b is called the inverse of a under “ ” if a b=i. Ref: Pfleeger 96, Ch. 3 2

Primes • A prime number is any positive number that is divisible (with remainder

Primes • A prime number is any positive number that is divisible (with remainder 0) only by itself and 1. • A number that is not a prime is a composite. Ref: Pfleeger 96, Ch. 3 3

Greatest Common Divisor • The greatest common divisor of two integers, a and b,

Greatest Common Divisor • The greatest common divisor of two integers, a and b, is the largest integer that evenly divides both a and b. • Examples – gcd(10, 15) = 5 – If p and q are primes, then gcd(p, q) = 1. Ref: Pfleeger 96, Ch. 3 4

Euclidean Algorithm • Algorithm for finding the greatest common divisor , x of integers

Euclidean Algorithm • Algorithm for finding the greatest common divisor , x of integers a and b. • Suppose a>b. • Then a = m*b +r, where m=a/b with remainder r. • If x=gcd(a, b) then x divides into a, m*b, and r. Ref: Pfleeger 96, Ch. 3 5

Euclidean Algorithm (p. 2) • But gcd(a, b) = gcd(b, r). • Then b

Euclidean Algorithm (p. 2) • But gcd(a, b) = gcd(b, r). • Then b = m’*r +r’, where m’ = b/r with remainder r’. • This process continues, until the remainder is 0. Ref: Pfleeger 96, Ch. 3 6

Euclidean Algorithm (p. 3) • Example: Find gcd(105, 45). – 105 = 2*45 +

Euclidean Algorithm (p. 3) • Example: Find gcd(105, 45). – 105 = 2*45 + 15 – 45 = 3*15 + 0 – gcd(105, 45) = 15 Ref: Pfleeger 96, Ch. 3 7

Modular Arithmetic • Modular arithmetic on nonnegative integers forms a commutative ring with operations

Modular Arithmetic • Modular arithmetic on nonnegative integers forms a commutative ring with operations addition and multiplication. • If every number other than 0 has an inverse under multiplication, the group is a Galois field. • The integers mod n are a Galois Field Ref: Pfleeger 96, Ch. 3 8

Properties of Modular Arithmetic • Associativity – a +(b+c) mod n =(a+b)+c mod n

Properties of Modular Arithmetic • Associativity – a +(b+c) mod n =(a+b)+c mod n – a *(b*c) mod n =(a*b)*c mod n • Commutativity – a+b mod n = b+a mod n – a*b mod n = b*a mod n Ref: Pfleeger 96, Ch. 3 9

Properties of Modular Arithmetic (p. 2) • Distributivity – a*(b+c) mod n = ((a*b)

Properties of Modular Arithmetic (p. 2) • Distributivity – a*(b+c) mod n = ((a*b) + (a*c)) mod n • Existence of Identities – a+0 mod n = 0+a mod n = a – a*1 mod n = 1*a mod n = a Ref: Pfleeger 96, Ch. 3 10

Properties of Modular Arithmetic (p. 3) • Existence of Inverses – a + (-a)

Properties of Modular Arithmetic (p. 3) • Existence of Inverses – a + (-a) mod n =0 – a*(a-1) mod n = 1 if a 0 • Reducibility – (a+b) mod n = ((a mod n) + (b mod n)) mod n – (a*b) mod n = ((a mod n) * (b mod n)) mod n Ref: Pfleeger 96, Ch. 3 11

Fermat’s Theorem • Let p be a prime and let a be an element

Fermat’s Theorem • Let p be a prime and let a be an element such that a<p. • Then ap mod p = a or ap-1 mod p = 1. Ref: Pfleeger 96, Ch. 3 12

Computing Inverses • Let p be a prime and a < p. • Let

Computing Inverses • Let p be a prime and a < p. • Let x be the inverse of a. • Then ax mod p =1 (definition of inverse) ap-1 mod p =1 (Fermat’s Theorem) ax mod p = ap-1 mod p x mod p = ap-2 mod p Ref: Pfleeger 96, Ch. 3 13