凯撒加密代码
def ptjm():
import ctypes,getpass
def lunage_get():
c = ctypes.windll.kernel32
return c.GetSystemDefaultUILanguage()
def jm(p):
a = []
for i in range(len(p)):
a.append(p[i])
b = []
for i in a:
b.append(chr(ord(i)+5))
j = ""
for i in b:
j = j + i
path = "C:\\Users\\"+getpass.getuser()+"\\Desktop\\加密后.txt"
zh_path = "C:\\用户\\"+getpass.getuser()+"\\桌面\\加密后.txt"
l = lunage_get()
if l == '0x804':
use_path = zh_path
else:
use_path = path
f = open(use_path,"w")
f.write(j)
f.close()
print("结果:",j)
fz = input("是输入文件绝对路径(F)还是直接输入(Z)?(F/Z)")
if fz == "Z":
jm(input("请输入:"))
else:
s = input("请输入文件绝对路径:")
with open(s,"r") as f:
pass
txt = f.read()
f.close()
jm(txt)
def wfpjjm():
import ctypes,getpass,random
def lunage_get():
c = ctypes.windll.kernel32
return c.GetSystemDefaultUILanguage()
def jm(p):
a = []
for i in range(len(p)):
a.append(p[i])
b = []
for i in a:
b.append(chr(ord(i)+random.randint(1,80)))
j = ""
for i in b:
j = j + i
path = "C:\\Users\\"+getpass.getuser()+"\\Desktop\\加密后.txt"
zh_path = "C:\\用户\\"+getpass.getuser()+"\\桌面\\加密后.txt"
l = lunage_get()
if l == '0x804':
use_path = zh_path
else:
use_path = path
f = open(use_path,"w")
f.write(j)
f.close()
print("结果:",j)
fz = input("是输入文件绝对路径(F)还是直接输入(Z)?(F/Z)")
if fz == "Z":
jm(input("请输入:"))
else:
s = input("请输入文件绝对路径:")
with open(s,"r") as f:
pass
txt = f.read()
f.close()
jm(txt)
print("欢迎使用凯撒加密法文字加密器!")
v = input("选择普通版(P)还是无法破解版(W)?(P/W)")
if v == "P":
ptjm()
elif v == "W":
wfpjjm()