Skip to content

Instantly share code, notes, and snippets.

@potat-dev
Created June 24, 2022 09:31
Show Gist options
  • Save potat-dev/ee7688c01c0617eab1e8a456c8eef114 to your computer and use it in GitHub Desktop.
Save potat-dev/ee7688c01c0617eab1e8a456c8eef114 to your computer and use it in GitHub Desktop.
# вычисляет хэш нескольких файлов
from hashlib import md5
def files_hash(files):
temp = md5()
for file in tqdm(files, desc="calculating files hash"):
with open(file, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
temp.update(chunk)
return temp.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment