class Spotixor: TEST = [0x2560a948, 0x421bca8b, 0x98329c40, 0x45d33a95] # screenshot_example.png @ staticmethod def v28decode (key0, key1, data4): out = data4 [:] # git clone https://gitlab.com/fuck-capitalism/spotifykeydumper # Hooks.cpp keyToLE_hook_v28 for index in range (15, -1, -1): left = out [(index - 1) & 3] out [index & 3] = (out [index & 3] + (((left + index + key0) & (left * 16 + key1)) * 2 - 17 * left - index - key1 - key0)) & 0xFFFFFFFF return out @ staticmethod def xordecode (key0, key1, data4): out = data4 [:] for index in range (15, -1, -1): left = out [(index - 1) & 3] a = left + index + key0 b = (left << 4) + key1 out [index & 3] = (out [index & 3] - (a ^ b)) & 0xFFFFFFFF return out @ staticmethod def xorencode (key0, key1, data4): out = data4 [:] for index in range (16): left = out [(index - 1) & 3] a = left + index + key0 b = (left << 4) + key1 out [index & 3] = (out [index & 3] + (a ^ b)) & 0xFFFFFFFF return out @ staticmethod def show (data): return ' '.join ("{:08x}".format (x) for x in data) def work_spot (): key0 = 0xcafebabe key1 = 0xdeadbeef data = Spotixor.TEST print ("data", Spotixor.show (data)) enco = Spotixor.xorencode (key0, key1, data) print ("enco", Spotixor.show (enco)) deco = Spotixor.v28decode (key0, key1, enco) print ("deco", Spotixor.show (deco)) dec2 = Spotixor.xordecode (key0, key1, enco) print ("dec2", Spotixor.show (dec2))