def check_hash(path, file_hash):
    path = os.path.expanduser(path)

    hash_parts = file_hash.split(':', 1)
    if len(hash_parts) != 2:
        # Support "=" for backward compatibility.
        hash_parts = file_hash.split('=', 1)
        if len(hash_parts) != 2:
            raise ValueError('Bad hash format: \'{0}\''.format(file_hash))
    hash_form, hash_value = hash_parts
    return get_hash(path, hash_form) == hash_value
Check if a file matches the given hash string
dataset/ETHPy150Open saltstack/salt/salt/modules/file.py/check_hash