**Post: #1**

rsa algorithm full report.doc (Size: 54.5 KB / Downloads: 449)

INTRODUCTION

RSA Algorithm was discovered by a group of three scientists namely Ron Rivest,Adi Shamir and Len Adleman and was first published in 1978.

The RSA scheme is a block cipher in which the plain text and cipher text are integers between 0 and n-1 for some n.

A Typical size of n is 1024 bits or 309 decimal digits.

This is a public key encryption scheme.

In this scheme two pairs of integers {e, n} and {d, n} are used. First of them i.e. {e.n} is called the RSA public key and the other one i.e. {d, n} is called the RSA secret key.

The sender uses the public key and encrypts the message say M into cipher text as â€œ

C = M^e mod n.

Where C is the cipher text and M is the message or the plane text

At the receiving end the receiver accept the cipher text C and decrypt the C into M using secret key {d, n}-

M = C^d mod n.

Example:

Let , e=3, d=7, n=33.

Suppose the message is ËœSUNâ„¢ and we use the numeric values of the characters according to their serial in alphabets.

Plaintext Ciphertext© after decryption

Sym num M^3 M^3 mod33 C^7 C^7mod33 sym

S 19 6859 28 13492928512 19 S

U 21 9261 21 1801088541 21 U

N 14 2744 5 78125 14 N

KEY GENERATION

The process of Key Generation contain the following steps

1- Select two prime numbers say p and q randomly

Where p q.

2- Calculate-

n = p *q.

3- Calculate ÃƒËœ(n) = (p-1) (q-1)

Note-

What is ÃƒËœ(n)

ÃƒËœ(n) is called the Eulerâ„¢s Totient function.

It is the no. of positive integers that are relative prime to n and are less then n.

For example: - to determine ÃƒËœ(35), we list all the positive integers less then 35 that are relatively prime to it:

1,2,3,4,6,8,9,11,12,13,16,17,18,19,22,23,24,26,27,29,31, 32,33,34.

There are 24 no on the list , so ÃƒËœ(35) =24.

One thing which is important is that the value of ÃƒËœ(1) is without meaning but is defined to have the value 1.

Â¢ It should be clear that for a prime no p ,

ÃƒËœ(p) = p-1.

Now suppose that we have two prime no p and q , with p does not equal to q .Then for n = pq

ÃƒËœ (n) = ÃƒËœ (pq) = ÃƒËœ (p)* ÃƒËœ (q) = (p-1)*(q-1).

Two integers are said to be relatively prime if there only common positive integer factor is one.

4- Select any integer e such that gcd (ÃƒËœ(n),e)=1;

1 < e < ÃƒËœ (n).

Note:-

Gcd means greatest common divisor. The gcd of any two positive integers can be calculated with the help of Euclidâ„¢s algorithm which is as under â€œ

EUCLID (a, b)

1. A a; B b

2. if B=0 return A = gcd (a, b)

3. R = A mod B

4. A B

5. B R

6. goto 2

5- calculate the value of d â€œ

de = 1 mod ÃƒËœ(n) or

d = e^-1 mod ÃƒËœ(n)

In calculation of Ëœdâ„¢ we need the multiplicative inverse of Ëœeâ„¢ modulo ÃƒËœ(n) .

We know that if gcd (m, b)=1, then b has a multiplicative inverse modulo m. That is, for positive integer b<m, there exists a b^-1 such that bb^-1=1mod m. Euclidâ„¢s algorithm can be extended so that, in addition to find gcd(m, b), if gcd is 1,the algorithm returns the multiplicative inverse of b. The extended Euclidâ„¢s algorithm is as under-

EXTENDED EUCLID (m, b)

1. (A1, A2, A3) (1, 0, m); (B1, B2, B3) (0, 1, B)

2. if B3=0 return A3 = gcd (m, b); no inverse

3. if B3=1 return B3 = gcd (m, b); B2 = b^-1 mod m

4. Q=+A3/B3+

5. (T1, T2, T3) (A1-QB1, A2-QB2, A3-QB3)

6. (A1, A2, A3)(B1, B2, B3)

7. (B1, B2, B3) (T1, T2, T3 )

8. Goto 2.

Throughout the computation, the following relationship hold:

mT1+bT2=T3 mA1+bA2=A3 mB1+bB2=B3

To see that this algorithm correctly runs gcd(m, b), note that if equate A and B in Euclidâ„¢s algorithm with A3 and B3 in the extended Euclidâ„¢s algorithm , then the treatment of two variables is identical. At each iteration of Euclidâ„¢s algorithm, A is set equal to the previous value of B and B is set equal to the value of A mod B.

similarly, at each step of extended Euclidâ„¢s algorithm,A3 is set equal to the previous value of B3,and B3 is set equal to the previous value of A3 minus the integer quotient of A3/B3 multiplied by B3.This latter value is simply the remainder of A3 divided by B3, which is A3mod B3.

Note also that if gcd (m, b) =1, then on the final step we would have B3=0 and A3 =1. Therefore, on the preceding step, B3 =1. But B3 =1, then we can say the following:

mB1+bB2=B3

mB1+bB2=1

bB2=1-mB1

bB2= 1mod m

And B2 is the multiplicative inverse of b, modulo m.

6. Public key of RSA is {e, n}

7. Private key of RSA is {d, n}

Encryption Algorithm:

Let, the message is M.

Where the M<n.

Ciphertext â€œ

C=M^e mod n.

Decryption Algorithm:

If the ciphertext is C, then the original message or the plaintext-

M=C^d mod n.

In encryption and decryption algorithms, we have to compute M^e and C^d respectively. This can be accomplished by an algorithm that can compute

a^b (mod n) and is given below-

c0; d1

for i k downto 0

do c 2*c

d (d*d) mod n

if bi =1

then c c+1

d (d*a) mod n

return d

The above algorithm computes a^ b mod n.

Where k- the no of bits in binary representation of the number Ëœbâ„¢ .

It means that first we convert the decimal number Ëœbâ„¢Into binary number say bk bk-1..b0 , and apply the above algorithm.

APPLICATIONS

Â¢ RSA is widely used for encryption and decryption in message communication for making the communication secure.

Â¢ It is used for digital signature.

Â¢ It is used for key distribution.

Â¢ RSA is used in e-commerce and remote banking.

Conclusion

After the study, I find that RSA is a powerful and most widely used scheme for encryption / decryption and digital signature. It is more secure than that of DES and others. But as we know that the key length for secure RSA use has increased over recent years, and this has put a heavier processing load on applications using RSA. This burden has ramifications, especially for electronic commerce sites that conduct large numbers of transactions.

Recently, a competing system has begun to challenge RSA: elliptic curve cryptography (ECC).

The principal attraction of ECC, compared to RSA, is that it appears to offer equal security for a far smaller key size; thereby reducing processing overhead but the confidence level in ECC is not yet as high as that is in RSA. Also RSA is fundamentally easier to explain than that of ECC.