RSA Algorithm and its implementation in C++.pptx

bani30122004 17 views 16 slides Feb 20, 2025
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

This ppt is showing details of RSA and implementation of RSA in C++.


Slide Content

RSA Algorithm: Pseudocode and Implementation in C++ Name: Anees ur Rehman Reg#: BCB242011 Design And Analysis Of Algorithm

Introduction What is RSA? RSA (Rivest-Shamir-Adleman) is a widely used public-key cryptosystem for secure data transmission. It is based on the mathematical properties of large prime numbers. Key Concepts: Public Key: Used for encryption. Private Key: Used for decryption. Applications: Secure communication (e.g., HTTPS, SSL/TLS). Digital signatures. Data encryption.

Common Problems Related to RSA Key Generation Challenges: Finding large prime numbers. Ensuring the security of the private key. Computational Complexity: Modular exponentiation is computationally expensive. Security Concerns: Vulnerable to brute-force attacks if key size is small. Vulnerable to quantum computing attacks (Shor’s algorithm). Implementation Issues: Handling large integers in programming languages.

RSA Algorithm Overview Steps in RSA: Key Generation: Choose two large prime numbers, p p  and q q . Compute . Choose public key e e  such that   and  . Compute private key  . Encryption: , where  M  is the plaintext message. Decryption: , where  C  is the ciphertext.  

1. Generate two large prime numbers, p and q. 2. Compute n = p * q. 3. Compute φ( n) = (p-1) * (q-1). 4. Choose e such that 1 < e < φ( n) and gcd (e, φ( n)) = 1. 5. Compute d such that d ≡ e^(-1) mod φ( n). 6. Public Key: (e, n). 7. Private Key: (d, n). Pseudocode for RSA Key Generation

1. Input: Plaintext message M, Public Key (e, n). 2. Compute ciphertext C = M^e mod n. 3. Output: Ciphertext C. Pseudocode for RSA Encryption

1. Input: Plaintext message M, Public Key (e, n). 2. Compute ciphertext C = M^e mod n. 3. Output: Ciphertext C. Pseudocode for RSA Encryption

1. Input: Ciphertext C, Private Key (d, n). 2. Compute plaintext M = C^d mod n. 3. Output: Plaintext M. Pseudocode for RSA Decryption

Working Example of RSA Step 1: Key Generation   Step 2: Encryption Let  M=65 . Compute    Step 3: Decryption Compute   

Time and Space Complexity Key Generation: Time Complexity:  , where  k  is the number of bits in  n . Encryption/Decryption: Time Complexity:   for modular exponentiation. Space Complexity: O(k) O ( k )  for storing keys and intermediate results.  

Implementation in C++

Implementation in C++

Implementation in C++

Summary RSA is a robust public-key cryptosystem based on the difficulty of factoring large prime numbers. It involves key generation, encryption, and decryption using modular arithmetic. Proper implementation requires handling large integers and ensuring security through appropriate key sizes. Applications include secure communication and digital signatures.

References Books: "Introduction to Algorithms" by Cormen , Leiserson , Rivest, and Stein. "Applied Cryptography" by Bruce Schneier. Online Resources: Wikipedia: RSA Algorithm GeeksforGeeks : RSA Algorithm

Thank you Anees ur Rehman Reg #: BCB242011
Tags