RSA and Python
2 days ago
- #Cryptography
- #Encryption
- #RSA
- RSA is an asymmetric cryptographic method with a public key for encryption and a private key for decryption.
- Key generation involves choosing two prime numbers, p and q, and calculating n = p * q.
- The Euler's totient function φ(n) is calculated as (p-1)*(q-1).
- A public exponent e is chosen such that it is coprime with φ(n).
- The private exponent d is calculated as the modular inverse of e modulo φ(n).
- Encryption involves converting characters to numeric values and applying the formula: c = m^e mod n.
- Decryption uses the private key to reverse the encryption: m = c^d mod n.
- RSA can be cracked by factorizing n into p and q, which allows calculating the private key.
- For security, RSA keys should be at least 512 bits long to resist factorization attacks.
- Quantum computers pose a future threat to RSA through Shor's algorithm, which can factorize large numbers efficiently.