in main.py [0:0]
def digest(filepath: str, method: str) -> str:
"""Calculates and returns the checksum of a file given a file path and a digest method (sha256, sha512 etc)"""
digester = hashlib.new(method)
with open(filepath, "rb") as file:
for chunk in iter(lambda: file.read(CHUNK_SIZE), b''):
digester.update(chunk)
return digester.hexdigest()