Difference between revisions of "Python - Using Hashlib"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) (Created page with " <pre> import hashlib def get_sha256_hash(filename): m = hashlib.sha256() with open(filename, 'rb', buffering=0) as f: for b in iter(lambda : f.read(128*1024), b''):...") |
PeterHarding (talk | contribs) |
||
| Line 15: | Line 15: | ||
[[Category:Python]] | [[Category:Python]] | ||
[[Category:Hashing]] | [[Category:Hashing]] | ||
[[Category:Examples]] | |||
Latest revision as of 19:26, 9 April 2018
import hashlib
def get_sha256_hash(filename):
m = hashlib.sha256()
with open(filename, 'rb', buffering=0) as f:
for b in iter(lambda : f.read(128*1024), b''):
m.update(b)
return m.hexdigest()