python计算文件的hash值
import hashlib
#读取文件
f = open('c:\\aaa.txt')
thehash = hashlib.md5()
#读取文件第一行
theline = f.readline()
#逐行读取文件,并计算
while(theline):
thehash.update(theline)
theline = f.readline()
#哈希值
thehash.hexdigest()
python计算文件的hash值
import hashlib
#读取文件
f = open('c:\\aaa.txt')
thehash = hashlib.md5()
#读取文件第一行
theline = f.readline()
#逐行读取文件,并计算
while(theline):
thehash.update(theline)
theline = f.readline()
#哈希值
thehash.hexdigest()