Chapter 4 – – Basic Concepts in Basic Concepts in Chapter 4 Cryptography and Cryptography and Number Theory and Finite Number Theory and Finite Network Security Network Security Fields Fields Chapter 4 Chapter 4 The next morning at daybreak, Star flew indoors, seemingly keen for The next morning at daybreak, Star flew indoors, seemingly keen for a lesson. I said, "Tap eight." She did a brilliant exhibition, first irst a lesson. I said, "Tap eight." She did a brilliant exhibition, f tapping it in 4, 4, then giving me a hasty glance and doing it in 2, 2, n 2, 2, tapping it in 4, 4, then giving me a hasty glance and doing it i 2, 2, before coming for her nut. It is astonishing that Star le 2, 2, before coming for her nut. It is astonishing that Star learned to arned to count up to 8 with no difficulty, and of her own accord discover count up to 8 with no difficulty, and of her own accord discovered ed Fifth Edition that each number could be given with various different divisions, this , this Fifth Edition that each number could be given with various different divisions leaving no doubt that she was consciously thinking each number. In leaving no doubt that she was consciously thinking each number. In fact, she did mental arithmetic, although unable, like humans, to fact, she did mental arithmetic, although unable, like humans, t o by William Stallings by William Stallings name the numbers. But she learned to recognize their spoken name the numbers. But she learned to recognize their spoken names almost immediately and was able to remember the sounds of names almost immediately and was able to remember the sounds of Lecture slides by Lawrie Lawrie Brown Brown Lecture slides by the names. Star is unique as a wild bird, who of her own free wi the names. Star is unique as a wild bird, who of her own free will ll pursued the science of numbers with keen interest and astonishing pursued the science of numbers with keen interest and astonishin g intelligence. intelligence. (with edits by RHB) (with edits by RHB) — Living with Birds — Living with Birds , Len Howard , Len Howard Outline Outline Introduction Introduction • will consider: will consider: • will build up to introduction of finite fields will build up to introduction of finite fields • • – – divisibility & GCD divisibility & GCD • of increasing importance in cryptography • of increasing importance in cryptography – modular arithmetic with integers modular arithmetic with integers – – AES, Elliptic Curve, IDEA, Public Key – AES, Elliptic Curve, IDEA, Public Key – – concept of groups, rings, fields concept of groups, rings, fields • concern operations on concern operations on “ “numbers numbers” ” • – Euclid Euclid’ ’s algorithm for GCD & Inverse s algorithm for GCD & Inverse – – where what constitutes a – where what constitutes a “ “number number” ” and the and the – – finite fields finite fields GF(p GF(p) ) type of operations varies considerably type of operations varies considerably n ) – polynomial arithmetic in general and in GF(2 polynomial arithmetic in general and in GF(2 n ) – • start with basic number theory concepts start with basic number theory concepts • • 将建⽴竌有限领域的引⼊兦 • 密码学的重要性⽇旦益增加 - AES ,椭圆曲线, IDEA ,公钥 • 关注 “ 数字 ” 操作 - 什茶么构成 “ 数字 ” ,操作类型差异很⼤夨 • 从基本数论概念开始 - 可分性和 GCD - 带整数的模运算 - 团体,戒指,领域的概念 - Euclid 的 GCD 和逆算法 - 有限域 GF ( p ) - ⼀丁般多项式算法和 GF ( 2n )
全等 Divisors Divisors Properties of Divisibility Properties of Divisibility • If a|1 , then a = ± ± 1 . • If a|1 , then 1 . a = • say a non say a non- -zero number zero number b b divides divides a a if for if for • • • If a|b If a|b and and b|a b|a , then , then a = ± ± b b . . a = some m some m have have a m.b ( ( a,b,m a,b,m all integers) all integers) a = = m.b b � � 0 • • Any b Any 0 divides divides 0 0 . . • • that is that is b b divides into divides into a a with no remainder with no remainder • If If a|b a|b and and b|c , then a|c • b|c , then a|c • write this write this b|a • b|a – e.g. e.g. 11|66 11|66 and and 66|198 66|198 implies implies 11|198 – 11|198 • and say that and say that b b is a is a divisor divisor of of a • a • • If If b|g b|g and and b|h b|h , then , then b|(mg b|(mg + + nh nh) ) • eg. all of eg. all of 1,2,3,4,6,8,12,24 1,2,3,4,6,8,12,24 divide divide 24 • 24 (for arbitrary integers m m and and n ) (for arbitrary integers n ) • eg. eg. 13|182 • 13|182 ; ; – –5|30 5|30 ; ; 17|289 17|289 ; ; – –3|33 3|33 ; ; 17|0 17|0 e.g. e.g. b 7 ; ; g 14 ; ; h 63 ; ; m 3 ; ; n b = = 7 g = = 14 h = = 63 m = = 3 n = = 2 2 7|14 and and 7|63 , hence 7|(3.14 7|63 , hence 7|(3.14 + + 2.63) 2.63) 7|14 Division Algorithm Division Algorithm Modular Arithmetic Modular Arithmetic • if divide if divide a a by by n n get integer quotient get integer quotient q q and and • • • define define modulo operator modulo operator a n to yield to yield a mod mod n remainder b b when when a a is divided by is divided by n remainder n integer remainder integer remainder r r such that: such that: – where integer – where integer n n is called the is called the modulus modulus r where where 0 ; q = floor floor (a/n – a a = = qn qn + + r 0 <= <= r r < < n n ; q = (a/n) ) – b is called a is called a residue residue of of a • b a mod mod n n • • remainder remainder r r often referred to as a often referred to as a residue • residue with integers can always write: a with integers can always write: a = = qn qn + + b b – usually choose smallest positive remainder as residue – usually choose smallest positive remainder as residue • ie • ie. . 0 0 <= <= b b <= <= n n- -1 1 – known as – known as modulo reduction modulo reduction • eg. • eg. - -12 12 mod mod 7 7 = = - -5 5 mod mod 7 7 = = 2 2 mod mod 7 7 = = 9 9 mod mod 7 7 a and and b b are are congruent congruent if if a • • a a mod mod n = b n = b mod mod n n a and and b b have same remainder when divided by have same remainder when divided by n – a – n – eg. eg. 100 – 100 = = 34 34 mod mod 11 11
Modular Arithmetic Operations Modular Arithmetic Operations Modular Arithmetic Operations Modular Arithmetic Operations • can perform arithmetic with residues can perform arithmetic with residues • 1.[(a mod n) + (b mod n)] mod n [(a mod n) + (b mod n)] mod n 1. = (a + b) mod n = (a + b) mod n • • use a finite number of values, and loop use a finite number of values, and loop back from either end back from either end 2.[(a mod n) 2. [(a mod n) – – (b mod n)] mod n (b mod n)] mod n Z n = {0,1,...,(n {0,1,...,(n – – 1)} 1)} = (a – – b) mod n b) mod n Z n = = (a • • modular arithmetic is doing addition and modular arithmetic is doing addition and 3.[(a mod n) x (b mod n)] mod n [(a mod n) x (b mod n)] mod n 3. multiplication and modulo reduce answer multiplication and modulo reduce answer = (a x b) mod n = (a x b) mod n e.g. e.g. • can do reduction at any point, i.e. can do reduction at any point, i.e. • [(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2 (11 + 15) m [(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2 (11 + 15) mod 8 = 26 mod 8 = 2 od 8 = 26 mod 8 = 2 [(11 mod 8) [(11 mod 8) – – (15 mod 8)] mod 8 = (15 mod 8)] mod 8 = – –4 mod 8 = 4 (11 4 mod 8 = 4 (11 – – 15) mod 8 = 15) mod 8 = – –4 mod 8 = 4 4 mod 8 = 4 a + + b b mod mod n = [a n = [a mod mod n + b n + b mod mod n] mod n n] mod n a [(11 mod 8) x (15 mod 8)] mod 8 = 21 mod 8 = 5 (11 x 15) mod 8 = 165 mod 8 = 5 od 8 = 165 mod 8 = 5 [(11 mod 8) x (15 mod 8)] mod 8 = 21 mod 8 = 5 (11 x 15) m Modulo 8 Addition Modulo 8 Addition Modulo 8 Multiplication Modulo 8 Multiplication + 0 1 2 3 4 5 6 7 + 0 1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 0 1 1 2 3 4 5 6 7 0 1 0 1 2 3 4 5 6 7 2 2 3 4 5 6 7 0 1 2 0 2 4 6 0 2 4 6 3 3 4 5 6 7 0 1 2 3 0 3 6 1 4 7 2 5 4 4 5 6 7 0 1 2 3 4 0 4 0 4 0 4 0 4 5 5 6 7 0 1 2 3 4 5 0 5 2 7 4 1 6 3 6 6 7 0 1 2 3 4 5 6 0 6 4 2 0 6 4 2 7 7 0 1 2 3 4 5 6 7 0 7 6 5 4 3 2 1 ( a + b ) mod n = [a mod n + b mod n] mod n
Recommend
More recommend