import hashlib


def hash_sha1(f_name):
    """
    returns the hash sha1 of the opened file
    :param f_name:file full path
    :return:(string) sha1_value 40-bit hexadecimal string.
    """
    try:
        h_sha1 = hashlib.sha1()
        with open(f_name, "rb") as f:
            for chunk in iter(lambda: f.read(), b""):
                h_sha1.update(chunk)
        return h_sha1.hexdigest()
    except Exception as e:
        raise Exception(e)