def METHOD_NAME(filepath, key):
    # Do keyed hashing
    # NOTE: This appears to be an implementation mistake on the Spelunky 2 dev's part
    # They generate a quad_round advanced version of (nonce'd key), but then they
    # xor with the untweaked key instead of the tweaked key...
    h = b""
    for i in range(0, len(filepath), 0x40):
        partial = filepath[i : i + 0x40]
        h += sxor(partial, key[: len(partial)][::-1])
    return h