# Shifty XOR

### My Bruteforce Script:

```python
def process_input(input_text):
    shifted_text = input_text[-1:] + input_text[:-1]  # Shift right by 1
    print(input_text, shifted_text)
    # XOR the shifted text against itself
    xor_result = ''.join(chr(ord(a) ^ ord(b)) for a, b in zip(input_text, shifted_text))
    
    # Convert the result to hex
    hex_output = xor_result.encode('utf-8').hex()

    # Write to file
    with open('output.txt', 'w') as f:
        f.write(hex_output)

# Decode script - Cascade XOR
# I assumed the value of the first byte and xored with first byte of the result. (canditate ^ res[0])
# Then generated all the strings possible with the rule: temp[i] = temp[i - 1] ^ res[i] (deduced from res[i] = temp[i] ^ temp[i - 1])

result = "686950021716160b1a54541b4f59161a590c41414d0c0f1759541b4f4f010b490c4f010b455716185946131b0d171d06014f016969530607174548071f1545541c0915544e014f4f010b45460f0e12071716534f1a0154414157161859541b4f421017040a4b491d580c4207060214061645541c09155457181a1908444207454b02070a444f094641161c1c1613164a0e743c0d45460a0d064749074e4302121645531c02080a010b4543020f4e491a536d2811152217123d0f03476f28434d2639131b0d1745015e31325d42416c335d5a586c365e4a510c42170154490f4659161a52551745521704050d070947541c011a5f0c696947121016005359161a55410d1e1704051d5942101d040e45491d5a00000e7732091c5c0c696e4b004c4a1f0607544b0e001550420709050c131f07094759161a55480917130b495355"
res = bytes.fromhex(result)

for canditate in range(32, 127):
    temp = [None] * len(res)
    p = canditate ^ res[0]
    temp[0] = p

    ok = True
    for i in range(1, len(res)):
        temp[i] = temp[i - 1] ^ res[i]

        if temp[i] < 32 or temp[i] > 126:
            ok = False
            break
    
    if ok:
        for i in temp:
            print(chr(i), end="")
        print("\n")
```

*made by k0d*
