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’
PayPal Gateway not configured
PayPal Gateway not configured