(key, data, n=32)
| 45 | v1 = (v1 + ((((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]))) & 0xFFFFFFFF; |
| 46 | return struct.pack(">2L", v0, v1) |
| 47 | def 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 | |
| 59 | if __name__ == "__main__": |
| 60 | usage = '''usage: %prog [options] input output_dir |
no test coverage detected