import hashlib


def _compute_wordlist_hash(filename: str, buffer_size: int = 64 * 1024) -> str:
    """
    We compute the hash based on the file contents, rather than the filename itself, since we
    want to know if the underlying contents of the file changes.

    This is akin to:
        $ sha1sum <filename>
    """
    sha1 = hashlib.sha1()
    with open(filename, 'rb') as f:
        data = f.read(buffer_size)
        while data:
            sha1.update(data)
            data = f.read(buffer_size)

    return sha1.hexdigest()