def is_sha1(instring):
    """Check if instring is sha1 hash."""
    if instring.endswith("-f"):
        instring = instring[:-2]
    if len(instring) != 40:
        return False
    try:
        int(instring, 16)
    except ValueError:
        return False
    return True