0% found this document useful (0 votes)
51 views

RSA Encryption: RSA Stands For The Creators of The Technique, Rivest, Shamir and Adelman

RSA encryption is a form of public-key encryption that uses prime factorization to encrypt and decrypt messages. It works by using two large prime numbers to generate a public key for encryption and a private key for decryption. The security of RSA comes from the fact that it is very difficult to factor very large prime numbers.

Uploaded by

Hassan Dyab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

RSA Encryption: RSA Stands For The Creators of The Technique, Rivest, Shamir and Adelman

RSA encryption is a form of public-key encryption that uses prime factorization to encrypt and decrypt messages. It works by using two large prime numbers to generate a public key for encryption and a private key for decryption. The security of RSA comes from the fact that it is very difficult to factor very large prime numbers.

Uploaded by

Hassan Dyab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

RSA Encryption

Introduction

Encryption is the process of converting information into “code” or


“data”. To convert data into encrypted data, it is required to use an
algorithm that makes the original information unreadable, not only does
encryption help companies or individuals from hackers but it is also used
as a way of communicating in the military and of course to understand
the information we will need to decrypt it.

RSA encryption is a form of encryption that is used today to secure data


safely and protect valuable information. The method of encryption is
usually public but the decryption method is private and only available to
the recipient. RSA stands for the creators of the technique,
Rivest, Shamir and Adelman.

The Caesar Cipher

A very basic form of encryption said to be used by Julius Caesar, the


Caesar Cipher. By using “key 1”, Letter A is concealed to B, B is
concealed to C, and so on. We view the alphabet as a loop so the Letter
Z is concealed as A.

A B CD E F G H I J K L M N O P Q R S T U V WX Y Z
0 1 23 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

The table above will help alot when encrypting and decrypting data.

When using the Caesar Cipher with key 10, then we encrypt each letter
by adding 10. For example, X is number 23, so we add 10 to that.
23+10=33 but we want a number that is between 0 and 25 inclusive. So,
33-26=7. Letter X is encrypted as the 7th letter of the alphabet or “H”.
The table below shows this for every letter of the alphabet.

A B C D E F G H I J K L M N O P Q R S T U V WX Y Z
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
K L MN O P Q R S T U V WX Y Z A B CD E F G H I J

Now that you know how to encrypt data using the Cesar Cipher, we can
get into decryption. For example, each letter has been encrypted using
key 10,

so Decrypt “OLBKRSW”

To do that you need to start with “O”, O is numbered “14” so you need to
subtract 10 since the “key” is 10. 14-10=4 So, the number 14 identifies
the same place in the alphabet as the number 4, which is “E”.

Letter L: 11-10=1 So, the number 11 identifies the same place in the
alphabet as the number 1, which is “B”.

Letter B: 1-10=-9, when getting a negative number you cannot continue


solving without making it between 0 and 25 and to make it that you need
to add it by 26. So, -9+26=17. So, the number -9 identifies the same
place in the alphabet as the number 17, which is “R”.

Letter K: 10-10=0. so, the number 10 identifies the same place in the
alphabet as the number 0, which is “A”.

Letter R: 17-10=7. So, the number 17 identifies the same place in the
alphabet as the number 7, which is “H”.

Letter S: 18-10=8. So, the number 18 identifies the same place in the
alphabet as the number 8, which is “I”.
Letter W: 22-10=12 So, the number 22 identifies the same place in the
alphabet as the number 12, which is “M”.

So the encryption would be translated to “EBRAHIM”.

Prime Numbers

RSA encryption is based on Prime Numbers and factoring them. Prime


numbers are numbers that are divisible by themselves and one
respectively, for example, 2,3,5,7,11 and so on..

Each prime number can be factorized as a product of powers of primes.


But, if we ignore the order of the prime powers, there would be only one
way to do this. For example, 2^2x3x5=60.

It is fairly easy to factor prime numbers but very difficult to factor very
large numbers considering there are infinitely many prime numbers, that
is what makes RSA very hard to crack by hackers.

How to encrypt and decrypt using RSA encryption

Step 1: Choose two prime numbers (p and q) let's say p=3 and q=11.

Step 2: let n=pq. For example, n=3x11, so n=33.

Step 3: Let A=(p-1)(q-1). For example, A=2x10 so A=20.

Step 4: Choose an integer “E” with 1<E<A so that E and A have no


common factors other than 1. For example, E=7.

Step 5: Find the integer D with 1< D<A so that D×E −1 is a multiple of A.
For example, (Dx7)-1=20 so D=3.

N and E are public keys but, D must be private.

Let's suppose a student wants to send a private message to his math


teacher, the student can make the values of “n” and “e” public but “D”
private. The message chosen was “MATH” and the numbers to each
letter in order respectively would be 2,3,4, and 5.

Step 1: Raise each number to the power of 7. (E=7)


So you will end up with M=128,A=2187,T=16384,H=78125.

Step 2: Find the remainders when each number is divided by 33. (n=33)

We start with letter M so, 128/33 after simplification we end up with


3R29.

Letter A: 2187/33 so, 66R9.

Letter T: 16384/33 so, 496R16.

Letter H: 78125/33 so, 2367R14.

Step 3: Raise all of the remainders you got by the power of 3.(D=3)

We start with letter M so, 29^3 which is simplified to be 24389.

Letter A: 9^3, simplified the answer would be 729.

Letter T: 16^3, simplified the answer would be 4096.

Letter H: 14^3, simplified the answer would be 2744.

Step 4: divide every answer you got from Step 3 by 33 (n=33)

Letter M: 24389/33 so, 739R2.

Letter A: 729/33 so, 22R3.

Letter T: 4096/33 so, 124R4.

Letter H: 2744/33 so, 83R5.

Step 5: Put all the remainders you got together and you will be back to
the original message. So, 2,3,4,5 is our original answer which translates
to MATH.

This equation is too simple to be used in real life to protect something


like a credit card number because the number n=33 is public and its
clear our two chosen primes would be 3 and 11 and with all that
information you can also find A which is 20, E is also public and its equal
to 7 and it's too simple to find D. To fix that problem we should use much
larger primes so it is very difficult to decrypt.
Another problem this equation has would be that we encrypted one letter
at a time, so each letter will have the same value once encrypted. This
makes the cipher very easy to break. To fix that problem we should
group all the letters together and encrypting them as a single number.

You might also like