import binascii
import re
import base64
ptext = input("Enter Plaintext\n\n\n")
print(ptext)
key = input("Enter Key\n\n\n")
print(key)
ptext01 = ""
key01 = ""
for c in range(0, len(ptext)):
ptext01 = ptext01 + ("%x" % ord(ptext[c]))
for c in range(0, len(key)):
key01 = key01 + ("%x" % ord(key[c]))
i = 0
j = 0
s = ""
while j < (len(ptext01)):
while i < (len(key01)):
if len(str(hex(int(key01[i:][:+2], 16) ^ int(ptext01[j:][:+2], 16)))[2:]) == 1:
s = s + "0" + str(hex(int(key01[i:][:+2], 16) ^ int(ptext01[j:][:+2], 16)))[2:]
else:
s = s + (hex(int(key01[i:][:+2], 16) ^ int(ptext01[j:][:+2], 16)))[2:]
i += 2
j += 2
if j >= len(ptext01):
break
i = 0
result= int(s, 16)
encodedBytes = base64.b64encode(str(result).encode("utf-8"))
encodedStr = str(encodedBytes, "utf-8")
print(encodedStr)
This is the code used to cipher the text, and this is the ciphertext:
NDcyMDI5MDYwMzI3MjM5NDgxNjc0NTgxMDI5OTYxMzIxMDQ1MjMxOTA3OTI1MDg5NDU3MTEyNTc2ODcyMzAxMzQ2NTAzMDMzNTgzMzc5MDMwNzYyODQ2NTU2NjQ2MTQ4MzQ1NjAwODQwOTgyNTc3MzM0NDk2Mjk1MTM2MjA5OTEzMTc5ODUwNzg2NzQ3MTU3NDc5MjQ4OTc4MDk0NDQ1Njk4Mzc1ODIxNDI5NjkwNDQ5NzAyMDIwMjUyMzIyMTY2MTI0MzM1MDc3MTc1MDI2OTcwNzMzMDI4NjI4Mjg0OTcxNzA3Nzc4MDY5NDI4NzIzODQxNzM3MzE1NTgxMDA5MjIzMzQyODQ2MDAwMTY1OTU4NzA1MDM3Mjg0MzYxMzQyOTMzNDA2MTMzMTA4OTkxNDg3MTQ2Mjk1ODM0NTI1MDEzOTU5NDgwNzg5ODMyMDYwMTcwMzQ3NTk1NjQyNjQzOTgzOTAzODQzMTAzMDQ4Nzg0ODE1MTc2MzQwNTQxOTUwMzI0MDM2MTg2NDg2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