Download presentation
Presentation is loading. Please wait.
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.