Created
February 12, 2024 05:06
-
-
Save vladimirgamalyan/170c168f1932cb935afe8ffe9c28e914 to your computer and use it in GitHub Desktop.
Python SHA sample
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
import hashlib | |
def sha256sum(filename): | |
with open(filename, 'rb', buffering=0) as f: | |
return hashlib.file_digest(f, 'sha256').hexdigest() | |
print(sha256sum('foo.bar')) | |
# sample output: | |
# E95ECA399DFE95500C4DE569EFC4CC77B75E2B66A864D467DF37733EC06A0FF2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment