Answers to Wei-Hwa's Puzzle Challenge 2 using PERL Code
Leave comments here: 2 comment(s)Decryption How-To:
After looking at the code, here is the ALL IMPORTANT! Decryption key map (Sorry, do not know the correct definition - pair wise?):
Decryption Key Map (DKM):
Decrypted: abcdefghijklmnopqrstuvwxyz
Encrypted: nopqrstuvwxyzabcdefghijklm
Note: a is n - n is a, b is o - o is b, c is p - p is c, etc.
Wei-Hwa's Code (Find under following comments in his code:
Clean other symbols: // We filter out any input that isn't a letter.
Decryption map: // build a map. (Not very efficient to do this every time, but what the heck.)
Answers: // should probably be a map, but I'm lazy.
Answer List:
- qnhtugreynhtugre
- srpnyqrpny
- sernxoernx
- travnyqravny
- trahfzrahf
- tebffpebff
- yntrejntre
- arhgreferhgref
- cbfgntrubfgntr
- ubfgntrcbfgntr
- gbhpurfqbhpurf
- ivfpbhagqvfpbhag
- lbhatreybhatre
PERL CODE (Only 3 lines! Actually 2 lines if I did not care about lower case.): (Download code: puzzle2decrypt.pl)
my ( $encryptedWord ) = lc( $decryptedAnswer );
$encryptedWord =~ tr/a-z/nopqrstuvwxyzabcdefghijklm/;
print "Decrypted Answer: $encryptedWord\n\n";
#Anyone want to fix this regex for me? How do you represent n-z and a-m in one line?
Execute Code: (Separate encrypted answers with space)
$ perl puzzle2decrypt.pl qnhtugreynhtugre srpnyqrpny sernxoernx travnyqravny trahfzrahf tebffpebff yntrejntre arhgreferhgref cbfgntrubfgntr ubfgntrcbfgntr gbhpurfqbhpurf ivfpbhagqvfpbhag lbhatreybhatre
Output:
You entered 13 encrypted answer(s) to decrypt.
Encrypted Answer: qnhtugreynhtugre
Decrypted Answer: daughterlaughter
Encrypted Answer: srpnyqrpny
Decrypted Answer: fecaldecal
Encrypted Answer: sernxoernx
Decrypted Answer: freakbreak
Encrypted Answer: travnyqravny
Decrypted Answer: genialdenial
Encrypted Answer: trahfzrahf
Decrypted Answer: genusmenus
Encrypted Answer: tebffpebff
Decrypted Answer: grosscross
Encrypted Answer: yntrejntre
Decrypted Answer: lagerwager
Encrypted Answer: arhgreferhgref
Decrypted Answer: neutersreuters
Encrypted Answer: cbfgntrubfgntr
Decrypted Answer: postagehostage
Encrypted Answer: ubfgntrcbfgntr
Decrypted Answer: hostagepostage
Encrypted Answer: gbhpurfqbhpurf
Decrypted Answer: touchesdouches
Encrypted Answer: ivfpbhagqvfpbhag
Decrypted Answer: viscountdiscount
Encrypted Answer: lbhatreybhatre
Decrypted Answer: youngerlounger
Cool! Must be the Mountain View air. Contact me if you have any questions.
<< Home