Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make a checksum to a file python

import hashlib

md5_hash = hashlib.md5()

a_file = open("test.txt", "rb")
content = a_file.read()
md5_hash.update(content)

digest = md5_hash.hexdigest()
print(digest)

'''
OUTPUT
4fcc82a88ee38e0aa16c17f512c685c9
'''
#Warning: Using a file that is too large may exceed system memory unless it broken into smaller chunks.
Source by www.adamsmith.haus #
 
PREVIOUS NEXT
Tagged: #checksum #file #python
ADD COMMENT
Topic
Name
6+4 =