mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-23 20:11:10 +00:00
Update main.py
This commit is contained in:
parent
7ee0bf1bca
commit
54f8a980f5
|
@ -1,6 +1,5 @@
|
||||||
import rsa
|
import rsa
|
||||||
|
|
||||||
|
|
||||||
##this function generates the keys
|
##this function generates the keys
|
||||||
def generate_keys():
|
def generate_keys():
|
||||||
(pubKey, privKey) = rsa.newkeys(1024)
|
(pubKey, privKey) = rsa.newkeys(1024)
|
||||||
|
@ -57,10 +56,10 @@ signature = sign_sha1(message, privKey)
|
||||||
##It then decrypts the message.
|
##It then decrypts the message.
|
||||||
plaintext = decrypt(ciphertext, privKey)
|
plaintext = decrypt(ciphertext, privKey)
|
||||||
|
|
||||||
##the cipher of the message is displayed
|
|
||||||
print(f'Cipher text: {ciphertext}')
|
|
||||||
##the sgnature of the message is displayed
|
##the sgnature of the message is displayed
|
||||||
print(f'Signature: {signature}')
|
print(f'Signature: {signature}')
|
||||||
|
##the cipher of the message is displayed
|
||||||
|
print(f'Cipher text: {ciphertext}')
|
||||||
|
|
||||||
##the decrypted message is displayed
|
##the decrypted message is displayed
|
||||||
if plaintext:
|
if plaintext:
|
||||||
|
@ -69,6 +68,6 @@ else:
|
||||||
print('Could not decrypt the message.')
|
print('Could not decrypt the message.')
|
||||||
|
|
||||||
if verify_sha1(plaintext, signature, pubKey):
|
if verify_sha1(plaintext, signature, pubKey):
|
||||||
print('Signature verified!')
|
print('great the signature is verified')
|
||||||
else:
|
else:
|
||||||
print('Could not verify the message signature.')
|
print('Could not verify the message signature.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user