A Ngawi Spy was arrested in Lempuyangan Railway Station while eating a bread. He was arrested becuse he wanted to deliver an encrypted secret message to another spy. It was known that the message is encrypted by bitwise operating the message with decimal digits of Pi. Can you decrypt the secret message?
Quite straightforward, we search up for the decimal digits up to the same length as the ciphertext. Then we XOR each digits with the corresponding hex values. Initially I was a bit confused since I XORed each of the ciphertext with int(pi[i]) but it doesn't work.
Solve.py
cipher = '755b5f124d12515047155b58425e5b461218605e5b45145a4018475a5219535c535f0214775059557f6d706d7f48440653047c735c690d685e0d5a0d74576d67034554055a616f0f775f0270045044'
pi = '1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502840'
byte_cipher =bytes.fromhex(cipher)decoded = []for i inrange(len(byte_cipher)): decoded.append(byte_cipher[i] ^ord(pi[i]))print(''.join(chr(i) for i in decoded))