34 lines
734 B
Python
34 lines
734 B
Python
|
"""
|
||
|
oh no
|
||
|
|
||
|
@author hornetfighter515
|
||
|
"""
|
||
|
import rsa
|
||
|
|
||
|
print('Generating keys...')
|
||
|
|
||
|
(pub_one, priv_one) = rsa.newkeys(2048)
|
||
|
(pub_two, priv_two) = rsa.newkeys(2048)
|
||
|
(pub_three, priv_three) = rsa.newkeys(2048)
|
||
|
|
||
|
print('Keys generated!')
|
||
|
|
||
|
message = 'hello world'
|
||
|
|
||
|
e_one = rsa.encrypt(message.encode(), pub_one)
|
||
|
e_two = rsa.encrypt(e_one[:128], pub_two)
|
||
|
e_three = rsa.encrypt(e_one[128:], pub_three)
|
||
|
|
||
|
print('Successfully encrypted!')
|
||
|
|
||
|
d_three = rsa.decrypt(e_three, priv_three)
|
||
|
d_two = rsa.decrypt(e_two, priv_two)
|
||
|
print(str(e_one))
|
||
|
print('-----------------------------')
|
||
|
print(str(d_two + d_three))
|
||
|
print(str(e_one) == str(d_two + d_three))
|
||
|
|
||
|
d_one = rsa.decrypt(d_two + d_three, priv_one)
|
||
|
|
||
|
print('Successfully decrypted ' + d_one.decode())
|