This repository has been archived on 2023-01-27. You can view files and clone it, but cannot push or open issues or pull requests.
flask-wikipages/app/hash_manager.py
2021-09-22 14:29:02 +03:00

18 lines
271 B
Python

import hashlib
BUF_SZ = 4096
def hash_file_sha512(filename):
res = hashlib.sha512()
with open(filename, 'rb') as f:
data = f.read(BUF_SZ)
while data:
res.update(data)
data = f.read(BUF_SZ)
return res.hexdigest()