add hashing
This commit is contained in:
parent
d08637eeba
commit
f5c1a6c0c3
1 changed files with 12 additions and 0 deletions
12
PyTeX/build/build/hashing.py
Normal file
12
PyTeX/build/build/hashing.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import hashlib
|
||||
from pathlib import Path
|
||||
|
||||
# https://stackoverflow.com/a/3431838/16371376
|
||||
|
||||
|
||||
def md5(file: Path):
|
||||
hash_md5 = hashlib.md5()
|
||||
with open(file, "rb") as f:
|
||||
for block in iter(lambda: f.read(4096), b""):
|
||||
hash_md5.update(block)
|
||||
return hash_md5.hexdigest()
|
Loading…
Reference in a new issue