Question - write a program that asks the user to enter a string and also ask the user to enter an integer key between 0-255. If the key is not of the correct range, keep asking the user to enter an appropriate key. Now write a function that can XOR encrypt the string given. Then print the encrypted string. Verify that you can decrypt the string as well.
plaintext = int(raw_input("enter string")) while True: b = int(raw_input("enter number between 0-255")) if b < 0 or b > 255: print "please renter number between 0-255=" else: break cipher_text = (plaintext) 'XOR encryption' for ch in plaintext: val = ord(ch) cipher_val = ... cipher_ch = chr(cipher_val) print (cipher_text)
I have left a few blanks because I just don’t know what to do , if I could get some help I would appreciate it , thank you