Tags: xor 

Rating:

```
def hashfun(msg):
digest = []
for i in range(len(msg) - 4):
digest.append(ord(msg[i]) ^ ord(msg[i + 4]))
return digest
```

The function simply does a XOR operation:

a ^ b = c

c ^ a = b

-----

We already know the first 4 characters of flag.

XORing the character at index 0 with the first item in the list gives us the character at index 0+4 and so on.

```
l = [10, 30, 31, 62, 27, 9, 4, 0, 1, 1, 4, 4, 7, 13, 8, 12, 21, 28, 12, 6, 60]
flag = "CSR{"

for i in range(len(flag)+len(l)-4):
flag += chr(l[i]^ord(flag[i]))
else:
print(flag)
```