Skip to content

Instantly share code, notes, and snippets.

@jandrusk
Last active August 29, 2015 14:22
Embed
What would you like to do?
get_hashes.py
def GetSHA512(filename):
# Function to return SHA512 hash of given file.
import hashlib
BLOCKSIZE = 65536
hasher = hashlib.sha512()
with open(filename, 'rb') as afile:
buf = afile.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(BLOCKSIZE)
return hasher.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment