Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data encryption with big prime numbers

Similar presentations


Presentation on theme: "Data encryption with big prime numbers"โ€” Presentation transcript:

1 Data encryption with big prime numbers
Daniel FreemaN, SLU

2 Old school codes Full knowledge of the code is needed to both encrypt messages and to decrypt messages. The code can only be used between a small number of trusted people.

3 Public key encryption If you buy something online, you need to send your credit card number to Amazon. Your computer needs to be able to encrypt your credit card number. Amazon does NOT want you to be able to decrypt other peopleโ€™s credit card numbers. Everyone needs to be able to encrypt but only Amazon should be able to decrypt. We need a mathematical technique that is computationally very simple to evaluate, but is extremely computationally difficult to invert.

4 Multiplication is easy, factoring is hard
Typing in the following into Wolfram Alpha * gives an output of Typing in the following into Wolfram Alpha factor gives an output of factor

5 Mod n We think of x mod n as the remainder when x is divided by n.
1โ‰ก7 ๐‘š๐‘œ๐‘‘ 3 2โ‰ก12 ๐‘š๐‘œ๐‘‘ 5 0โ‰ก15 ๐‘š๐‘œ๐‘‘ 5 More generally, xโ‰กy mod n means that x and y have the same remainder when divided by n, or that x-y is a multiple of n. 10โ‰ก7 ๐‘š๐‘œ๐‘‘ 3 22โ‰ก12 ๐‘š๐‘œ๐‘‘ 5 30โ‰ก15 ๐‘š๐‘œ๐‘‘ 5

6 Modular exponentiation
3 1 โ‰ก3 ๐‘š๐‘œ๐‘‘ 5 3 42 โ‰ก ๐‘š๐‘œ๐‘‘ 5 3 2 โ‰ก9โ‰ก4 ๐‘š๐‘œ๐‘‘ 5 โ‰ก ๐‘š๐‘œ๐‘‘ 5 3 3 โ‰ก3โˆ— 3 2 โ‰ก3โˆ—4 โ‰ก12โ‰ก2 ๐‘š๐‘œ๐‘‘ 5 โ‰ก (3 2 ) 5 (3 2 ) ๐‘š๐‘œ๐‘‘ 5 3 4 โ‰ก3โˆ— 3 3 โ‰ก3โˆ—2 โ‰ก6โ‰ก1 ๐‘š๐‘œ๐‘‘ 5 โ‰ก 4 5 โˆ—4 3 โˆ—4 ๐‘š๐‘œ๐‘‘ 5 โ‹ฎ โ‰ก4 ๐‘š๐‘œ๐‘‘ 5 Fermatโ€™s little theorem: Let p be a prime number and let x be an integer that is not divisible by p. Then, ๐‘ฅ ๐‘โˆ’1 โ‰ก1 mod p or ๐‘ฅ ๐‘ โ‰กx mod p

7 Key points of modular exponentiation
xm mod n can be efficiently calculated by expressing the exponent m in binary. Fermatโ€™s little theorem: Let p be a prime number and let x be an integer that is not divisible by p. Then, ๐‘ฅ ๐‘โˆ’1 โ‰ก1 mod p Eulerโ€™s theorem: Let p and q be distinct prime numbers and let x be an integer that is not divisible by p or q. Then, ๐‘ฅ (๐‘โˆ’1)(๐‘žโˆ’1) โ‰ก1 ๐‘š๐‘œ๐‘‘ ๐‘๐‘ž ๐‘ฅ ๐‘โˆ’1 ๐‘žโˆ’1 +1 โ‰ก๐‘ฅ ๐‘š๐‘œ๐‘‘ ๐‘๐‘ž More generally, if m โ‰ก 1 mod (p-1)(q-1) then ๐‘ฅ ๐‘š โ‰ก๐‘ฅ ๐‘š๐‘œ๐‘‘ ๐‘๐‘ž

8 RSA encryption Choose 2 large prime numbers p and q. Calculate n=pq.
p and q should be so large that it is not computationally feasible to factor n. n will be publicly shared, but p and q will be secret. Choose a positive integer e which is relatively prime to (p-1)(q-1). e will be publicly shared. Choose a positive integer d such that ed โ‰ก 1 mod (p-1)(q-1) d will be secret Suppose someone wants to encrypt the integer x such that 1<x<n-1. They encrypt x as the value y โ‰ก xe mod n To decrypt, we exponentiate to the power d to get yd โ‰ก xed โ‰ก x mod n

9 RSA example Choose p = 2498359 q = 5418341
p and q are just two big prime numbers Calculate n = pq = * = Calculate ฯ†(n) = (p-1)(q-1) = * = Choose e = e was picked to be a prime number big enough to most likely not a factor of (p-1)(q-1) Solve ed โ‰ก 1 mod (p-1)(q-1) d = Suppose you want to send the number x= to Amazon. You calculate and send y= โ‰ก xe mod n Amazon then calculates x โ‰ก yd mod n


Download ppt "Data encryption with big prime numbers"

Similar presentations


Ads by Google