RSA_Algorithm_Assignment

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Assignment: RSA Algorithm

The RSA algorithm is one of the most widely used public-key cryptosystems,

named after its inventors Rivest, Shamir, and Adleman. It is employed for secure

data transmission and relies on the mathematical properties of prime numbers and

modular arithmetic.

1. Key Generation:

- Select two large prime numbers, p and q.

- Compute n = p * q, where n is the modulus for both the public and private keys.

- Compute phi_n = (p-1)(q-1), where phi_n is Euler's totient function.

- Choose a public key exponent e such that 1 < e < phi_n and gcd(e, phi_n) = 1.

- Calculate the private key exponent d such that (e * d) mod phi_n = 1.

2. Encryption:

- The sender obtains the recipient's public key (n, e).

- The plaintext message M is converted into an integer m such that 0 <= m < n.

- Compute the ciphertext c using the formula: c = (m^e) mod n.

3. Decryption:

- The recipient uses their private key (n, d) to decrypt the ciphertext c.

- Compute the plaintext message m using the formula: m = (c^d) mod n.

Example:

Let p = 61 and q = 53. Then, n = p * q = 3233 and phi_n = (p-1)(q-1) = 3120.

Choose e = 17, which satisfies gcd(17, 3120) = 1. Calculate d = 2753,

as (17 * 2753) mod 3120 = 1.

To encrypt a message m = 65:


c = (65^17) mod 3233 = 2790.

To decrypt c = 2790:

m = (2790^2753) mod 3233 = 65.

Applications of RSA Algorithm:

1. Secure data transmission in online communications.

2. Digital signatures for authentication.

3. Key exchange in secure protocols like SSL/TLS.

You might also like