Skip to content

Instantly share code, notes, and snippets.

@jandrusk
Last active August 29, 2015 14:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jandrusk/671f4dce73d0252662f1 to your computer and use it in GitHub Desktop.
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