import hashlib


def file_hash(path):
    """
    Return hash generated from file's contents.
    """

    HASH_BLOCKSIZE = 1 << 20
    hash = hashlib.md5()

    with open(path, 'rb') as f:
        while True:
            data = f.read(HASH_BLOCKSIZE)

            if not data:
                break

            hash.update(data)

        h = int(hash.hexdigest(), 16)

    return h