import hashlib


def compute_sha1(path, buf_size=65536):
    """
    Takes a path and compute the hash of that file.
    In order to process huge files we break them in chunks of buf_size dimension

    Parameters
    ----------
        path: str or Path
            Path to the file
        buf_size: int
            size of the chunks we divide the file into

    Returns
    ----------
    int
        sha1 of the file
    """

    # lets read stuff in 64kb chunks!

    sha1 = hashlib.sha1()

    with open(path, 'rb') as f:
        while True:
            data = f.read(buf_size)
            if not data:
                break

            sha1.update(data)

    return sha1.hexdigest()