

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: RSA
incomplete
2: RSA vs. ECC
incomplete
3: RSA Key Generation
incomplete
4: Totient and E
incomplete
5: Modular Arithmetic
incomplete
6: Modular Arithmetic
incomplete
7: Encryption
incomplete
8: Multiplicative Inverse
incomplete
9: Private Key
incomplete
10: Decryption
incomplete
11: Encryption and Decryption Explained
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
While (n, e) is the public key, d is the private key. That said, d can be derived from p and q, so you can also consider the pair of p and q the private key, but it's just different ways to look at it.
At the end of the day, p, q, tot and d should all be kept secret, there's no reason to share anything other than (n, e).
d is simply the modular multiplicative inverse of e (mod tot).
Complete the getD function.
func getD(e, tot *big.Int) *big.Int
Use the ModInverse method to calculate d and return it.