Created
March 23, 2015 13:34
-
-
Save albertzaharovits/4f692286a9ae288e4a58 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
def get_hash(file_path, hash_name="sha256", block_size=4096): | |
# hash_name = md5 / sha256 / sha512 | |
hash = hashlib.new(hash_name) | |
with open(file_path, "rb") as f: | |
for block in iter(lambda: f.read(block_size), ""): | |
hash.update(block) | |
return hash.hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment