hashlib加密了文件,不会解密了
代码如下:
import hashlib
import os
def get_sha1(f):
xd = open('D:/1.zip', 'rb').read()
gys = xd
os.remove('D:/1.zip')
sha1 = hashlib.sha1(gys)
osv = sha1.hexdigest()
print(osv)
bx = bytes(osv, encoding='utf-8')
with open('D:/1.abc', 'wb') as f:
f.write(bx)
def get_sha2(f):
xd = open('D:/1.abc', 'rb').read()
gys = xd
os.remove('D:/1.abc')
sha2 = hashlib.sha1(gys)
osv = sha2.hexdigest()
print(osv)
bx = bytes(osv, encoding='utf-8')
with open('D:/1.zip', 'wb') as f:
f.write(bx)
get_sha2('')