Rating:

```py
def validate_flag(flag):
encoded_flag = encode_flag(flag)
expected_flag = 'ZT_YE\\0|akaY.LaLx0,aQR{"C'
if encoded_flag == expected_flag:
return True
else:
return False

def encode_flag(flag):
encoded_flag = ""
for c in flag:
encoded_char = chr((ord(c) ^ 0xFF) % 95 + 32)
encoded_flag += encoded_char
return encoded_flag
```

I wrote a decoder function which reverses it (thanks to @hollowcrust).

```py
def decode_flag(flag):
decoded_flag = ""
for c in flag:
tmp = (ord(c)-32 + 95) ^ 0xFF
if(tmp > 122) or (tmp < 48):
tmp = (ord(c)-32 + 190) ^ 0xFF
decoded_char = chr(tmp)
decoded_flag += decoded_char
return decoded_flag

>>> "flagd1D_U_g3t_tH15_onE?"
```

Flag: `flag{d1D_U_g3t_tH15_onE?}`

Original writeup (https://jpalayoor.com/reverse/HSCTF-10.html#brain-hurt).