Download presentation
Presentation is loading. Please wait.
1
CMPS 2433 – Coding Theory Chapter 3
2
SECURITY Accuracy
3
Cryptography - Coding The Code Book, Simon Singh
Public-key cryptography Number theory Codes & Error-Correcting Codes
4
Error Checking - Accuracy
Even/Odd Parity Each byte transmitted has one bit added so number of ones is even (or odd) Checked upon receipt – reject if number of ones is NOT even (odd) >99% of all transmission errors are in one bit Example Original: Sent:
5
Error Correcting Parity
Send a set of multiple (8) bytes as a matrix. Set parity bit on rows & columns Example
6
Error Correcting Parity
Send a set of multiple (8) bytes as a matrix. Set parity bit on rows & columns Example – even parity
7
Error Correcting Parity
Send a set of multiple (8) bytes as a matrix. Set parity bit on rows & columns Example – even parity – one bit error * *
8
Division Algorithm If m & n are integers, m ≠ 0, n can be written as n = m*q + r, where 0 <= r < |m|. q & r are the quotient & remainder of n/m Examples: Divide 82 by 7 ~~ 82 = 11 * 7 + 5 Divide 26 by 7 ~~ 26 = 3 * 7 + 5 * 82 & 26 are Congruent Modulo 7 because they have the same remainder
9
Congruence ~ is a Relation
Define the congruence relation as follows: Cm = {(a,b)| a & b are integers & have the same remainder when divided by m} Example: C7 = {(82,26), (5,12), (19,5) (4,11), (2,23) (49,0)…}
10
Properties of Congruence
Reflexive? Symmetric? Transitive? Notation: 82 ≡ 26 mod 7 49 ≡ 0 mod 7 Are there equivalence classes?
11
Equivalence Classes for Congruence
Given Cm, how many equivalence classes? Example: Consider C7 [0] = { [1] = { [2] = { Any more???
12
Equivalence Classes for Congruence
Given Cm, how many equivalence classes? Example: C7 [0] = {0, 7, 14, 21,…} [4] = [1] = {1, 8, 15, 22,…} [5] = [2] = {2, 9, 16, 23,…} [6] = [3] = {3, 10, 17, 24…} [7] =
13
Examples of Congruence
Clock Time Hours: (mod 12) + 1 mod 24 Clock Time Minutes mod 60
14
Examples of Congruence
Calendars ~ Days of the Week If Sunday = 0, Monday = 1, etc….. Mod 7 will give us days of week IF used correctly
15
Note on Modulus on Negatives
If m & n are integers, m ≠ 0, n can be written as n = m*q + r, where 0 <= r < |m|. (Note r MUST be positive) q & r are the quotient & remainder of n/m Examples: -34/7 – Which is correct?? -34 = -4 * 7 – r = -6 -34 = -5 * r = 1
16
Euclidean Algorithm *Greatest Common Divisor (GCD)
Given 2 integers A & B, the largest integer that divides both is called the Greatest Common divisor (GCD) Examples: GCD (12,8) GCD (200, 1000) GCD (7, 122)
17
Theorem 3.3 (p.107) Let a, b, c, & q be integers with b > 0. If a = qb + c, then gcd(a,b) = gcd(b,c) Example: find gcd(105, 231) gcd(231, 105) 231 = 2 * gcd(105, 21) 105 = 5 * gcd(21, 0) = 21
18
The Euclidean Algorithm (p.108) Calculates gcd(m,n)
r-1 = m, r0 = n, I = 0 While rI≠0 //(division algorithm) I = I determine qI, rI for rI-2/rI-1 Print rI-1
19
Complexity of Euclidean Algorithm
Lame – 1844: no more than 5 * number of digits in smaller of 2 numbers Theorem 3.4 (p. 109) If the Euclidean Alg. is applied to m & n with m ≥ n > 0, the number of divisions needed is less than or equal to 2 log2 (n+1). Thus, O(log2 n).
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.