import hashlib #########测试################# m = hashlib.md5() m.update(b"hello") m.update(b"world") print(m.hexdigest()) #fc5e038d38a57032085441e7fe7010b0 m1 = hashlib.md5() m1.update(b"helloworld") print(m1.hexdigest()) #fc5e038d38a57032085441e7fe7010b0 ##########测试完毕############# ‘‘‘ 生成文件的MD5值 ‘‘‘ m2 = hashlib.md5() f = open("sss.py", "rb") data = f.read(1024) while data: m2.update(data) data = f.read(1024) print(m2.hexdigest()) # fb5aced33c5d7fb053b506abbf766df7
原文地址:https://www.cnblogs.com/staff/p/9643840.html
时间: 2024-10-27 08:32:08