Spaces:
Sleeping

File size: 264 Bytes
45e7ae0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import hashlib


def generate_file_hash(file_path: str) -> str:
    hash_sha256 = hashlib.sha256()

    with open(file_path, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_sha256.update(chunk)

    return hash_sha256.hexdigest()