Im trying to enter multiple numbers such as
[106, 103, 110, 110, 113, 32, 121, 113, 116, 110, 102]
into the decryption using the ord()
, then enter it through the caeser cipher. The caeser cipher works, but I dont know how to make work the chr()
, but it shows that it is an error when I key in the numbers.
Thank you!
print("Decryption")
text = int(input("Enter encrypted numbers: \n"))
encrypt = chr(text)
decrp_key = int(input("Enter key:\n"))
decrypted_text = ""
for i in range(len(encrypt)):
if ord(encrypt[i]) == 32:
decrypted_text += chr(ord(encrypt[i]))
elif ((ord(encrypt[i]) - decrp_key) < 97) and ((ord(encrypt[i]) - decrp_key) > 90):
temp = (ord(encrypt[i]) - decrp_key) + 26
decrypted_text += chr(temp)
elif (ord(encrypt[i]) - decrp_key) < 65:
temp = (ord(encrypt[i]) - decrp_key) + 26
decrypted_text += chr(temp)
else:
decrypted_text += chr(ord(encrypt[i]) - decrp_key)
print("Decrypted Text: " + decrypted_text)```