# You're the NSA, trying to decrypt a message between two friends

You're a secret agent working for the NSA and you have monitored the messages between two friends for a while now. Suddenly, their messages become encrypted and you're on high alert. The first part of their message was sent twice (accidentally), an encrypted and decrypted version. This was the message:

The package has arrived, I am ready for pickup. When and where shall we meet?


Encrypted:

r.4NC"Hm,20QV}*;. AI&*BU3;%);.-6/2NUF=eOt-+3Jq%2]TpH,MCJ5!F*}HT?jX,R>EqC''*H


Further analysis show the keyword was password. The next part of the message was sent encrypted, but with a different key. All you could find out about the keyword was that it is 4 letters long. The message was this:

pt3sLuD,91~1o&,:# D0bVs{O'Mov;vC%l3yFb


Time is running out and you fear it may be dangerous! Can you decrypt the message in time?

EDIT: I will post a hint later on today

Hint 1:

C++ code (very basic) here for algorithm (won't spoil the answer!)
(This is my repo) https://github.com/Cube777/cube-lib/blob/master/src/cube-encrypter.cpp

Hint 2: Another hint:

The keyword is not an English word, but a sequence of 4 letters (not an abbreviation but a popular sequence of 4 letters)

• Man, the NSA must be really desperate to outsource their work here so often. – Joe Z. Apr 10 '15 at 15:55
• The number of characters is the same before and after encryption, so most likely we have to find a direct relationship between each character and its encrypted equivalent – leoll2 Apr 10 '15 at 16:16
• Added the hint! :) Good luck! – Cube777 Apr 10 '15 at 17:45
• Hmm, I sort of assumed that figuring out the encryption algorithm used was half the puzzle... – Joe Z. Apr 10 '15 at 17:52
• Well, given that you decided to use Hungarian Notation for everything, the code is unreadable to me >_> – Joe Z. Apr 10 '15 at 17:56

Alright, so I used your code to create a brute-force generator to determine all possible decodings for all four-letter words. Since the input was a four-letter word, I assumed that it was also lowercase, and so the search space was only $26^4 = 456~976$, totally feasible for brute force.
Then, a quick search for an isolated "the" turned up all I needed: the key was asdf and the plaintext was Coldplay makes the world's best music!.
• There should be a movie about this answer. (Suggestion for the title: The Immitation Game 2`). – ibrahim mahrir Nov 28 '17 at 21:45