The RSA cryptosystem is a public-key encryption method where two large prime numbers p and q are chosen, and n = p × q is computed. The encryption exponent e and decryption exponent d are selected such that e × d ≡ 1 mod φ(n), where φ(n) = (p-1)(q-1). The security relies on the computational difficulty of factoring large composite numbers into their prime factors. The encryption process computes x^e mod n, and decryption computes (x^e mod n)^d mod n, which recovers the original message x. This works because x^(e×d) ≡ x mod n when e×d ≡ 1 mod φ(n), proven using Euler's theorem and Fermat's little theorem.
RSA Cryptosystem: Key Generation, Encryption, and Decryption
Added:have a nice time to today our topic of discussion is RSC crypto system suppose AR want to send a secret number to Bob what she will do is she will encode the number using some mathematical key and send the message to Bob Bob knows how to decode it using some other mathematical key so this will keep the privacy of the message so today we will study how to construct the mathematical keys for encryption and decryption using RSA crypto system first let us have an example consider the set m is equal to set 0 1 2 3 Etc 14 and consider the function from M to M given by F ofx = to x cu/ 15 that is the remainder obtained from the number X cube is divided by 15 so these are some values of the function given if x equal to0 we have X Cube and divid 15 remainder zero so if you have 3 3 Cub is 27 27 when divided by 15 the remainder is to likewise we have constructed the values of X and F ofx here the question is if you know X you know how to calculate F ofx now suppose you have given the value of f of x for a particular X can you predict the value of x such that f of x is equal to 13 so here by inspection can see that the same function Works to the inverse part also that is for example if you have 2 2 Cub is 8 8 when divided by 15 the remainder is 8 itself and you have if f of x = 4 then you can take 4 CU 64 64 when divided by 50 the remainder is four so the same rule is working from X to f of x and from f of x to X or we can see that F of f ofx = to X itself this concept is actually working behind RS Cryptor system actually you have to construct some f and you have to find the function G such that g of f ofx becomes X itself so let us go to the theoretical part first let us explain what is meant by RSA crypto system in RSA crypto system actually we choose two gigantic prime numbers p and Q and let N is equal to P into Q the product of the primes P into q and we use this p and Q to find the numbers e and D such that f of x = x e/ n and G of x = x to D / n and the circuit point is that g of f of x becomes X itself that is X to e/ n raised to D / n = to X itself that is we finding then X ra to e then we divide the number by n and find the remainder then we take to the power D again divide by n and find the remainder then the answer becomes X so the encoding part is the encoder will find X the power e and find the remainder when divided by n that is sent to the receiver and uh he will find D power of what he received and find the remainder when divided by m becomes the actual message here n and E will reveal to the public to encode the number the encoder must know what should be the E uh Power e that he has to do X ra to okay so n and E will reveal to the public but p q and E will keep secret and the security lies in the fact that it is very difficult to factorize a number into P into Q uh if the number is very big this very difficult to factorize this as product of primes now let us prove a result x the^ e / n = x ^ n / n to the power D / n so first we write x^ e as Q into n + x ^ e / n that is when we divide x the^ e by n q is the quotient and this part is the Remer reminder actually you are giving this notation and what becomes X to e e into D that is q1 + x^ e/ d e e e let us prove the congr for p case one if P divides X that is X a multiple of P then X congruent is Z mod that is when X is a multiple of P when X is divided by P the remainder is zero and you will take uh s it is plus one you're taking K into P -1 into Q -1 + 1^ of x then that is congruent to 0 to the power K into Kus 1 into K - 1 + 1 that is again Z so it's conent to 0 mod and you know that Z is congruent to X mode so you can write here as X to K into pus1 into Q -1 + 1 is congruent to x p now case two is p doesn't divides x p is a prime and that is not a factor of X means that greatest common device of X and P = to 1 that is there is no common factors for p and X the only common factors one therefore by format theorem you know x to the power 5 of p is congruent to 1 mod P and 5 of p is p minus one p of p means that number of primes less than p and related Prime to P so the number is pus one so we have the relation X ra to P minus 1 congruent to 1 more p so therefore X to K into p-1 into Q -1 congruent to 1 to K into Q -1 it is congruent to 1 and we are multiplying X to both sides we will get the result so we have the result x to the power K into P -1 into Q -1 + 1 is conent to XE n if n is = to P into Q X is a new integer and K is a natural number now we are going to the procedure of RSA crypto system we will use the previous results to fix capital and E and D in RSA crypto system the procedure is so we select two gigantic primes p and Q and the product is taken as capital n and using p andq you have to find the number e and D the requirement is the decoder will find x to the power e over n and will send to the receiver and the receiver will script is as if it is capital Y he will find y^ d/ n and the answer becomes capital x so this is a procedure working in RSA crypto system so we choose the number of p and Q such that capital N is equal to P into Q then what will be 5 of n 5 of n is by formula it is n into that is p into Q into 1 - 1 by P into 1 - 1 by Q so that's equal to P into Q into 1 P - 1 by P into Q - 1 by q that is 1 - P sorry P - 1 into Q -1 now let e be a number relatively prime to pus1 into q minus1 that is the way in which e is selecting okay is a number relatively prime to this 5 of so that means that gcd of this e and P -1 into Q -1 = 1 so if gcd of two numbers equal to 1 you can find the numbers Lambda and mu satisfying this relation that is Lambda into p-1 into Q -1 + mu into eal to 1 because this pus1 q-1 and E are gcd1 now we can select this mu in a particular way that 0 less than mu less than pus1 into Q -1 so let me go to the theoretical part again for example let n and n be two inte such that gcd of NN isal 1 so there exist integers Lambda and mu such that Lambda into m + mu into n = 1 so the result here is we can choose this mu such that mu is less than M and suppose what happens if mu is greater than M okay so it becomes Lambda m+ if mu is greater than M we can divide mu by m and mu can be written as some quotient into M plus some remainder Let It Be mu Das so into n = to 1 okay I'm combining the terms with M and you can write this as some Lambda Das into M plus mu Das into n = 1 now we can see that this mu Das is less than n because mu Das is the remainer obtained when mu is divided by m hence we can choose mu such that 0 less than mu less than pus1 into Q -1 because here gcd of pus1 into q- 1 and E = to 1 and Lambda and mu is Chen in such a way and since this e and mu are integers greater than zero what happens to this equation this 1 minus mu e becomes negative in the right hand side and you know p minus1 is positive and Q -1 is positive so this Lambda must be negative the simpli Lambda less than Z and we called minus Lambda as K and this particular mu as d d is a integer we want to decode the message then what happens to this equation this becomes I'm taking this minus mu to this side and this Lambda into pus1 into Kus 21 to this side and what I get is uh K into this minus Lambda becomes k k into P - 1 into Q -1 + 1 equal to D into e actually we want to show that when we choose Lambda sorry when we choose e and D in this way then X to d x to e/ n to the^ D / n = to X itself so here x to e / n to the power D / n = to x e into D / n this result we have proved earlier and this is equal to X to K into P -1 into Q - 1 + 1 because D equal to this one okay and we have already proved that when we divide this expression by n remainder becomes X that is proved as a proposition so what we proved do if you have a number X you just find x to the power e then divide the number by capital N find the remainder then take that number to the power T again divide the number by n and find the remainder it becomes X so this is is the theory working behind RSA crypto system now let us illustrate the process using a problem suppose capital N is equal to 5 into 7 these two are prime numbers and the product is 35 5 of n is equal to P -1 into Q -1 that is 24 we have to choose the number e which is relativity Prime to 24 I choose it as 5 now gcd of 24 and 5 is equal to 1 by ukan algorithm I can write 1 is = to -1 into 24 + 5 into 5 the proof we have shown that this number becomes a Lambda becomes Nega and we choose the number five as our number D and you can decode any sorry you can encrypt any number from 0 to 34 using this process because we have taken capital n as 35 so I can encode the numbers from 0 to 34 for example if I take x = 3 e = to 5 so we will find 3 5 and we'll find the remainder obtained when it is divided by 35 so that's equal to 33 so we decode the number three as 33 and the receiver will find 33 ra to 5 because b equal to 5 here so 33 to 5 when divided by 35 remainder is 3 which is X itself so this is a process of RSA crypto system here the second security of the system lies in the fact that it is very difficult to find the prime factors of a number even RSA Labs has put forward several factoring challenges the hardest unsolved challenges uh one in which a 617 digits number capital N is given and you are asked to factorize the number as P into q and if you can find the factors p and Q you will be able to claim the uh2 lakhs uh dollar price money and this shows that is very difficult to factorize a number into its prime factors and in the coming classes we will discuss some algorithms which are available to find the prime factors of a number thank you
Up Next

Python Basics for Robotics: Prerequisite Guide
@mecharithm-robotics
3.9K views•2023-08-29

Building Real-Time ML Pipelines with Feature Stores and MLOps Frameworks
@ODSCAI
5.1K views•2022-02-20

Bypassing Tor Censorship: Bridges and Pluggable Transport Guide
@Coding_ForEveryone
397 views•2024-06-11

Neural Networks Explained: Math, Layers, and Learning Fundamentals
@3blue1brown
21.9M views•2017-10-05
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Artificial Intelligence



![[Matematika Diskrit] Algoritma dan Bilangan Bulat | yutikamelia](https://i.ytimg.com/vi/jic6g4lHGe4/maxresdefault.jpg)
![INVERSE MODULO | DIOPHANTINE EQ | NMBER THEORY (PART-4) | CP FROM SCRATCH [IN HINDI] [2020]](https://i.ytimg.com/vi/IQQKrcDkfvE/sddefault.jpg)



























![[An toàn bảo mật thông tin] - Chữ ký số RSA](https://i.ytimg.com/vi/IVLnUBilnII/maxresdefault.jpg)










