MCPcopy Create free account
hub / github.com/defold/defold / xtea_decryptCTR

Function xtea_decryptCTR

scripts/unpack_arc.py:47–57  ·  view source on GitHub ↗
(key, data, n=32)

Source from the content-addressed store, hash-verified

45 v1 = (v1 + ((((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]))) & 0xFFFFFFFF;
46 return struct.pack(">2L", v0, v1)
47def xtea_decryptCTR(key, data, n=32):
48 global XTEA_BLOCK_SIZE
49 counter = 0;
50 for i in range(0, len(data), XTEA_BLOCK_SIZE):
51 enc_counter = xtea_decrypt(counter, key, n)
52 for j in range(0, XTEA_BLOCK_SIZE):
53 if i+j >= len(data):
54 break
55 data[i+j] = (data[i+j] ^ enc_counter[j]) & 0xFFFFFFFF
56 counter += 1
57 return data
58
59if __name__ == "__main__":
60 usage = ''&#x27;usage: %prog [options] input output_dir

Callers 1

unpack_arc.pyFile · 0.85

Calls 1

xtea_decryptFunction · 0.85

Tested by

no test coverage detected