我应该如何为此编写解密程序?
我正在尝试使用Python 编写解密代码。加密工作并在名为 myfile 的文件中输出以下 119105108108 116104105115 11911111410763 ,其中包含“这有效吗?”。但我不知道如何解密它,也不知道它是否可以解密,希望得到一些帮助。
#declare variables
fo = 0
ascii_val = []
asci_val = []
asc_val = []
listtostr = 0
listtost = 0
listtos = 0
split_val = 0
x = 0
#open files
fo = open("myfile.txt","r")
fo1 = open("hora.txt","w")
#read text from files and put into a list
txt = fo.read()
split_val = txt.split(" ")
print(split_val)
#process of encrypting using ascii values
for x in split_val[0]:
y = x.split()
a = ord(x)
a =str(a)
ascii_val.append(a)
print()
#process
for x in split_val[1]:
a = ord(x)
a =str(a)
asci_val.append(a)
print()
#process
for x in split_val[2]:
a = ord(x)
a =str(a)
asc_val.append(a)
#joining ascii values together
listtostr = "".join([str(x) for x in ascii_val])
listtost = "".join([str(x) for x in asci_val])
listtos = "".join([str(x) for x in asc_val])
#joining all of the ascii values together
b = listtostr + " " + listtost +" " + listtos
print(b)
#writing to new file
fo1.write(b)
#close files
fo.close()
fo1.close()
I am trying to write an decryption code using Python. The encryption works and outputs the following 119105108108 116104105115 11911111410763 for the words "will this work? in a file called myfile. But i have no idea how to decrypt it or whether it can even be decrypted and would love some help.
#declare variables
fo = 0
ascii_val = []
asci_val = []
asc_val = []
listtostr = 0
listtost = 0
listtos = 0
split_val = 0
x = 0
#open files
fo = open("myfile.txt","r")
fo1 = open("hora.txt","w")
#read text from files and put into a list
txt = fo.read()
split_val = txt.split(" ")
print(split_val)
#process of encrypting using ascii values
for x in split_val[0]:
y = x.split()
a = ord(x)
a =str(a)
ascii_val.append(a)
print()
#process
for x in split_val[1]:
a = ord(x)
a =str(a)
asci_val.append(a)
print()
#process
for x in split_val[2]:
a = ord(x)
a =str(a)
asc_val.append(a)
#joining ascii values together
listtostr = "".join([str(x) for x in ascii_val])
listtost = "".join([str(x) for x in asci_val])
listtos = "".join([str(x) for x in asc_val])
#joining all of the ascii values together
b = listtostr + " " + listtost +" " + listtos
print(b)
#writing to new file
fo1.write(b)
#close files
fo.close()
fo1.close()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论