Last active
July 20, 2017 04:36
-
-
Save blubberdiblub/5a8bc84403cfed0ec063 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import hashlib | |
def chunked_sha1sum(filelike, chunk_size=0x100000): | |
hasher = hashlib.new('sha1') | |
while True: | |
chunk = filelike.read(chunk_size) | |
if not chunk: | |
break | |
hasher.update(chunk) | |
return hasher.hexdigest() | |
with open('some_dvd_dump.iso', 'rb') as f: | |
sha1sum = chunked_sha1sum(f) | |
print(sha1sum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment