import hashlib
hash_md5 = hashlib.md5()
x=input("Please input your text:")
print( "Text:",x)
data = x.encode('utf-8', errors='ignore')
hash_md5.update(data)
md5_str = hash_md5.hexdigest()
print("MD5:",md5_str)
from random import *
rad="".join([choice("0123456789ABCDEF") for i in range(32)])
print ( "key:", rad)
txt1=[]
t=''
u=''
for a in range(32):
i='0x'+md5_str[a]
j='0x'+rad[a]
p=bin(eval(i)).replace('0b','')
q=bin(eval(j)).replace('0b','')
for c in range(min(len(p),len(q))):
if (p[-c]==q[-c]) :
e='0'
elif(p[-c]!=q[-c]):
e='1'
t=e+t
t='0b'+t
d=t
t=''
s=hex(eval(d)).replace('0x','')
u=u+s
print("CipherText:",u)