Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematics of Cryptography

Similar presentations


Presentation on theme: "Mathematics of Cryptography"— Presentation transcript:

1 Mathematics of Cryptography

2 Topics Integer Arithmetic Modular Arithmetic Matrices
Linear Congruence

3 Integer Arithmetic Set of Integers Binary Operations
Denoted by Z, contains all integral natural numbers (with no fraction) from negative infinity to positive infinity. Binary Operations Takes two inputs and gives one output. We will be using, addition, subtraction and multiplication Z= {………,-4-3,-2,-1,0,1,2,3,4………}

4 Z= {………,-4-3,-2,-1,0,1,2,3,4………} + - x a c b

5 Integer Division a=q x n +r Z= {………,-4,-3,-2,-1,0,1,2,3,4………} a
If we divide ‘a’ by ‘n’ then we end up with ‘q’ and ‘r’ such that a = q x n + r, where ‘a’ - dividend, ‘q’ - quotient, ‘r’ - remainder and ‘n’ - divisor. Two restrictions are imposed: ‘n’ should be positive integer and ‘r’ should be non-negative integer. Z= {………,-4,-3,-2,-1,0,1,2,3,4………} a=q x n +r n (positive) q a r (non-negative)

6 The Graph of the relation
Consider 2 cases wherein a is positive and a is negative.

7 a = q x n (a is divisible by n or n divides a)
Divisibility If ‘a’ is non zero and if we get r = 0, then we have the relation, a = q x n (a is divisible by n or n divides a) When we are not interested in the value of ‘q’, then we denote as a | n When a is not divisible by n then we indicate this using this notation a + n Properties If a | 1, then a= ± 1 If a | b and b | a, then a= ± b If a | b and b | c, then a | c If a | b and a | c, then a | (m x b + n x c), where m and c are arbitrary integers

8 All divisors A positive integer can have more than one divisor.
Fact 1: The integer 1 has only one divisor, itself Fact 2: Any positive integer has at least two divisors, 1 and itself.

9 Greatest Common Divisor (GCD)
GCD is the often required integer in Cryptography GCD – of two positive integers is the largest integer that can divide both the integers. For the above mentioned example: GCD (140,12) = 4

10 gcd(36,10)= gcd(10,6)= gcd(6,4)= gcd(4,2)= gcd(2,0)=2
Euclidean Algorithm Finding GCD of numbers by listing all the common divisors is not feasible especially when the numbers are large. 2000 years ago, Euclid developed an algorithm to find the GCD of two positive numbers. Fact 1: gcd (a,0) = a Fact 2: gcd (a,b) = gcd (b,r), where r is the remainder of dividing a by b. Example: gcd(36,10)= gcd(10,6)= gcd(6,4)= gcd(4,2)= gcd(2,0)=2 If gcd (a,b) = 1, then a and b are relatively prime

11 The Extended Euclidean Algorithm
Given two integers a and b, we need to find other two integers s and t, such that s x a + t x b = gcd(a,b). Procedure is same as Euclidean algorithm, but we will consider two more set of operations for s and t. Initialization: s1=1, s2=0, t1=0 and t2=1 r = r1 – q x r2, s = s1 - q x s2, and t = t1 – q x t2 , where q = r1/r2

12 x = x0+k(b/d) and y = y0+k(a/d), where k is an integer
Linear Diophantine Equations Equations of type ax+by=c are called as linear Diophantine equations We need to find x and y. These kind of equations either have no solutions or infinite solutions. Let d = gcd (a,b). If d + c, then equation has no solution. If d | c, then we have infinite number of solutions. (1 is particular and rest are general solutions) To find the particular solution: x0 = (c/d)s and y0 = (c/d)t To find the general solution: x = x0+k(b/d) and y = y0+k(a/d), where k is an integer Example: 21x + 14y = 35

13 Modular Arithmetic a = q x n + r mod
In division relationship, we reviewed 2 values: q and r. In modular arithmetic, we will concentrate only on ‘r’. This implies we can view it as a binary relation (2 inputs and 1 output) Division Relation Modulo Operator Z= {………,-2,-1,0,1,2,………} a = q x n + r n r Z= {………,-2,-1,0,1,2,………} mod n r a a q

14 Set of residues: Zn The result of modulo operation with modulus n is always between 0 and n-1. Modulo operation creates a set known as set of least residues modulo n or Zn Zn= {0,1,2,3,4………(n-1)} Z2= {0,1} Z5= {0,1,2,3,4} Z11= {0,1,2,3,4,5,6,7,8,9,10}

15 Congruence Residual classes
Mapping from Z to Zn is not one-to-one. Infinite numbers of Z can map to one member of Zn. Consider, 2 mod 10 = 2, 12 mod 10 = 2, 22 mod 10 = 2. Instead of equality operator we will use congruence operator (≡). Since, 3 ≡ 8 (mod 5), 8 ≡ 13 (mod 5), 34 ≡ 24 (mod 10) are true, we infer that congruence is many-to-one. Residual classes A residual class [a] or [an] is the set of integers congruent modulo n If n = 5, then its residual classes are [0],[1],[2],[3],[4] [0] = {….,-15,-10,-5,0,5,10,15,…..} [1] = {….,-14,-9,-4,1,6,11,16,…..}

16 Circular Notation All congruent modulo n occupy the same point on the circle.

17 Operations in Zn Operations are (a+b) mod n = c (a-b) mod n = c
Binary operations (addition, subtraction, multiplication) that are applicable on set Z, are also applicable in set Zn Operations are (a+b) mod n = c (a-b) mod n = c (a*b) mod n = c Example: Add 7 to 14 in Z15 (14+7) mod 15  21 mod 15 = 6

18 Properties (a+b) mod n = [(a mod n) + (b mod n)] mod n (a-b) mod n = [(a mod n) - (b mod n)] mod n (axb) mod n = [(a mod n) x (b mod n)] mod n

19 Inverses When working on modular arithmetic, we often need to find the inverse of a number relative to an operation. Normally, additive and multiplicative inverses are used. Additive inverse In Zn, two numbers a and b are additive inverses of each other if a + b ≡ 0 (mod n) Sum of an integer and its inverse is congruent to 0 modulo b. Example 1: Additive inverse of 4 in Z10 is 10 – 4 = 6 Example 2: Find all the additive inverses pairs on Z10 (0,0) (1,9) (2,8) (3,7) (4,6) (5,5)

20 Multiplicative inverse
An integer may nor may not have multiplicative inverse. When it does, the product of the integer and its multiplicative inverse is congruent to 1 modulo n. In Zn, two numbers a and b are multiplicative inverses of each other if a x b ≡ 1 (mod n) Example 1: If the modulus is 10 and a is 3 then the multiplicative inverse of 3 is 7, i.e. (3 x 7) mod 10 = 1. ‘a’ has a multiplicative inverse in Zn, if and only if gcd (n,a)=1 Example 2: Find the multiplicative inverse of 8 in z10 gcd (10,8) = 2, which is not equal to 1, hence there are no multiplicative inverse of 8 in z10. We cannot find any number between 0 and 9 such that when that when multiplied by 8, the result is congruent to 1

21 During encryption if sender is using an integer then at the receiving end, inverse of that integer will be used. If the operation is addition, Zn can be used but if the operation is multiplication then Zn cannot be used because not all integers have their multiplicative inverse in Zn Instead of Zn we have Zn* , which is set of integers with multiplicative inverses. Example: Z6 = {0,1,2,3,4,5} and Z6* = {1,5}

22 Matrices Definition, Addition, Subtraction, Multiplication Inverses
Additive Inverse: of matrix A is another matrix B such that A + B = 0. Multiplicative Inverse: is defined only for square matrices. A and B, such that A x B = B x A = I Residue matrices: Matrices with all the elements on Zn.

23

24 Linear Congruence Cryptography usually involves system of equations of one or more variables with coefficients in Zn. Single-Variable Linear Equations Equations of the form : ax ≡ b (mod n) Result: No solutions or limited solutions. Assume, gcd (a,n) = d. If d + b, then no solutions, if d | b, then d solutions. Steps: Reduce the equation by dividing both sides by d. Multiply both sides by the multiplicative inverse of a to find x0 General Solutions are x =x0+ k (n/d) for k=0,1,….,(d-1)

25 Example 1: Solve: 10x ≡ 2 (mod 15)
Gcd (10,15) = 5. Since 5 does not divide 2, so solution Example 2: Solve 14x ≡ 12 (mod 18) Gcd (14, 18) = 2. Since 2 divides 12, we have two solutions 14x ≡ 12 (mod 18) 7x ≡ 6 (mod 9) x ≡ 6 * 7-1 (mod 9) x0 = 6 * 4 (mod 9) = 6 x1 = x0 + 1 (18/2) = 15

26 Set of Linear Equations
The matrix formed by the coefficients of the variables is invertible. n value should be same for all the equations. Example: 3x + 5y + 7z ≡ 3 (mod 16) x + 4y + 13z ≡ 5 (mod 16) 2x + 7y + 3z ≡ 4 (mod 16)

27 Can machines keep us safe from cyber-attack?
EXTRA: 1 (Machine versus Hackers) Can machines keep us safe from cyber-attack? The Defence Advanced Research Projects Agency (DARPA) has more recently brought engineers together to tackle what it considers to be "grand challenges". Aims to develop software smart enough to spot and seal vulnerabilities in other programs before malicious hackers even know they exist.

28 EXTRA: 2 The flaws were found in software that handles graphics and in code that controls communication between different processes running inside a phone. Exploiting the bugs would allow an attacker to gradually be able to take more control over a device and gain access to its data. Checkpoint has created a free app called QuadRooter Scanner that can be used to check if a phone is vulnerable to any of the bugs.

29 EXTRA: 3 http://fossbytes
EXTRA: 3 hacking-and-penetration-testing-2016/


Download ppt "Mathematics of Cryptography"

Similar presentations


Ads by Google