-
-
Save Gunni/7c1c00b2390c1472492ac12042f06c06 to your computer and use it in GitHub Desktop.
python sha512 using mmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Switch sha512 out for any other if you want | |
# Use hexdigest if you want a "normal" hex version of the digest | |
def hashFile(path): | |
with open(path, 'r') as fh, mmap.mmap(fh.fileno(), 0, prot=mmap.PROT_READ) as map: | |
return hashlib.sha512(map).digest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment