python 3 哈希验证文件 验证文件的sha 256
来源:岁月联盟
时间:2012-07-05
import hashlib
import os
import sys
def sha256(filename, onlyname):
f = open(filename, 'rb')
sh = hashlib.sha256()
sh.update(f.read())
print (sh.hexdigest(),"*",onlyname )
f.close()
return
path = sys.path[0]
print(path)
list1=os.listdir(path)
print(path + list1[4])
for i in range(0,len(list1)):
if (os.path.isfile(path + '//' + list1[i]) == True ):
sha256(path + '//' + list1[i], list1[i])
下一篇:wxPython事件