Add Elliptic Curve and docs
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# Generating RSA Keys
|
||||
In the following section, we are going to see how to generate RSA Keys and how to encrypt data with these keys.
|
||||
|
||||
```
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from Cryptotools.Encryptions.RSA import RSA
|
||||
|
||||
|
||||
rsa = RSA()
|
||||
rsa.generateKeys(size=512)
|
||||
|
||||
e = rsa.e
|
||||
d = rsa.d
|
||||
n = rsa.n
|
||||
|
||||
s = "I am encrypted with RSA"
|
||||
print(f"plaintext: {s}")
|
||||
encrypted = rsa.encrypt(s)
|
||||
|
||||
# Encrypt data
|
||||
print(f"ciphertext: {encrypted}")
|
||||
|
||||
# We decrypt
|
||||
plaintext = rsa.decrypt(encrypted)
|
||||
print(f"Plaintext: {plaintext}")
|
||||
```
|
||||
Reference in New Issue
Block a user