def encoder(path,pwd,topath):
"""
@path: file path you wish to encrypt including filename
@pwd: seek value 'you should remember that if you want to decrypt it'
@topath: file path for encrypted file included filename
"""
k = long(pwd) # key # password in int
f1 = open( path, "rb") # file path you wish to encrypt
bytearr = map (ord, f1.read() )
f1.close()
f2 = open( topath, "wb" ) # path for encrypt file to write
random.seed(k)
for i in range(len(bytearr)):
byt = (bytearr[i] + random.randint(0, 255)) % 256
f2.write(chr(byt))
f2.close()
给你需要的东西
你有没有试过在谷歌上搜索它,甚至是stackoverflow。在
退房PyCrypto
您也可以搜索本机python实现,但是效率会降低。在
相关问题 更多 >
编程相关推荐