150 likes | 492 Views
Properties of Arithmetic. Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996. 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.
E N D
Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996. Ref: Pfleeger96, Ch.3
Identity and Inverses • Let “” denote an operation on numbers. • A number i is called an identity for operation “” if x i = x andi x = x for every number x. • The number b is called the inverse of a under “” if ab=i. Ref: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
Euclidean Algorithm (p.3) • Example: Find gcd(105,45). • 105 = 2*45 + 15 • 45 = 3*15 + 0 • gcd(105,45) = 15 Ref: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
Properties of Modular Arithmetic (p.3) • Existence of Inverses • a + (-a) mod n =0 • a*(a-1) mod n = 1 if a0 • 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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3
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: Pfleeger96, Ch.3