Created
September 28, 2022 02:36
-
-
Save pjaudiomv/91729e20ce8846ef08a5b322f55a2d48 to your computer and use it in GitHub Desktop.
sha256 sum python
This file contains hidden or 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 get_hash(file): | |
''' | |
Return sha256 hash of file | |
''' | |
sha256_hash = hashlib.sha256() | |
with open(file,"rb") as f: | |
for byte_block in iter(lambda: f.read(4096),b""): | |
sha256_hash.update(byte_block) | |
return sha256_hash.hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment