14

# A puzzle, just for fun. Two friends, (a)lice and (b)ob are communicating through a channel encrypted with random numbers XOR'd together, like so: keyA = randint(1024, 1024**2) keyB = randint(1024, 1024**2) msg = randint(1024, 1024**2) You, an interloper, have watched all these communications, siphoning the packets as they went. When alice sends a message to bob's mailbox, she does it like so: mailBoxB = keyA^msg Bob's mailbox receives the mail automatically, and applies his own key, sending it back to alice's mailbox: mailBoxA = keyB^mailBoxB Next, Alice's mailbox notices the message, and automatically removes her key and sends it back to bob's mailbox. All of this, the first message, the second, and the third, happens in milliseconds, the back and forth. mailBoxB2 = mailBoxA^keyA Finally, bob's mailbox removes his key, and deposits the now unencrypted message in his box, for him to read in the morning: mailBoxBFinal = mailBoxB2^keyB As as a spy, you know the first packet sent to bob, had a value of 589505. The packet bob sent back to alice, after applying his key, has a value of 326166 The message sent *back* to bob after alice removed *her* key, had a value of: 576941 What are the values of keyA, keyB, and what is the value of the msg?

• 10
mailBoxB = keyA^msg = 589505
mailBoxA = keyB^mailBoxB = 326166
mailBoxB2 = mailBoxA^keyA = 576941

keyA^msg = 589505
keyB^keyA^msg = 326166
keyB^keyA^msg^keyA = 576941

keyA^msg = 589505
keyB^keyA^msg = 326166
keyB^msg^keyA^keyA = 576941

keyA^msg = 589505
keyB^keyA^msg = 326166
keyB^msg^0 = 576941

keyA^msg = 589505
keyB^keyA^msg = 326166
keyB^msg = 576941

keyA^msg = 589505
keyB^589505 = 326166
keyB^msg = 576941

keyA^msg = 589505
keyB = 326166^589505
keyB^msg = 576941

keyA^msg = 589505
keyB = 326166^589505
msg = 576941^326166^589505

keyA = 589505^576941^326166^589505
keyB = 326166^589505
msg = 576941^326166^589505

keyA = 800699
keyB = 787671
msg = 313722
• 4
@Fast-Nop flawless execution.

But you're dead wrong. The msg is actually 42 /jk.
• 2
@Wisecrack I admit I was slightly disappointed that it wasn't. :)
• 2
@Fast-Nop missed opportunity -_-