Course Solutions Uncategorized (Solved) : Need Modify Python Code Bellow Take Given Text Plaintext Encrypt Given Key Save Encrypted Q32317974 . . . .

(Solved) : Need Modify Python Code Bellow Take Given Text Plaintext Encrypt Given Key Save Encrypted Q32317974 . . . .

 

I need to modify the python code bellow such that it can take agiven text (plaintext), encrypt it with a given key, save theencrypted message in a new file(cyphertext), save the key in a newfile, use the key to decrypt the message, and provide the decryptedmessage (back to the plaintext).

from __future__ import print_function, unicode_literals

from os import urandom

def genkey(length):
“””Generate a Key”””
return urandom(length)

def xor_strings(s, t):
“””xor two strings together”””
if isinstance(s, str):
#text strings contain single characters
return “”.join(chr(ord(a) ^ ord(b))for a, b in zip(s,t))

else:
#Python 3 bytes objects contain integer values in the range0-255
return bytes([a ^ b for a, b in zip (s,t)])

message=’This is a secret’

print

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post