Skip to content Skip to navigation

Decrypt the message!

Category: 

Task:

Decrypt the message!

And 'ecnrypted.txt' is attached to task:

The life that I have
Is all that I have
And the life that I have
Is yours.

The love that I have
Of the life that I have
Is yours and yours and yours.

A sleep I shall have
A rest I shall have
Yet death will be but a pause.

For the peace of my years
In the long green grass
Will be yours and yours and yours.

decrypted message: emzcf sebt yuwi ytrr ortl rbon aluo konf ihye cyog rowh prhj feom ihos perp twnb tpak heoc yaui usoa irtd tnlu ntke onds goym hmpq

 Solution:

We've got an encrypted message and a poem, so it looks like Poem Code, whatever. Wiki article is not good enough, so i recommend this one, or just google it :)

First step is to find words which form key. First group of letters from encrypted message is "emzcf", it means that 5th, 13th, 26th, 3th and 6th are used. Those words are: 

"have life life that is", but there are only 18 letters and we need 25 (because we have 25 blocks of 4 letters each, and it's indicate that original message was splitted in 4 blocks with length 25, so key have same length - 25). Lets check all words by modulo:

5th have yours my

13th life shall be

26th life pause

3th that have peace

6th Is and years

Maximum word's length is 5, so we need five 5-letters words to reach sufficient key's length. There is only one way to choose words: "yours shall pause peace years". Now we can compute key:

passphrase = "yoursshallpausepeaceyears"
alph = string.ascii_lowercase
count = 1
passkey = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for a in alph:
	for i in xrange(len(passphrase)):
		if passphrase[i:i+1] == a:
			passkey[i] = count
			count +=1

print "Key is " + str(passkey)

Output is: Key is [24, 13, 22, 16, 18, 19, 10, 1, 11, 12, 14, 2, 23, 20, 6, 15, 7, 3, 5, 8, 25, 9, 4, 17, 21]

Next step is decrypting:

encrypted = ["sebt", "yuwi", "ytrr", "ortl", "rbon", "aluo", "konf", "ihye", "cyog",
"rowh", "prhj", "feom", "ihos", "perp", "twnb", "tpak", "heoc", "yaui", "usoa", "irtd",
"tnlu", "ntke", "onds", "goym", "hmpq"]

result =""
for i in xrange(4):
	for j in xrange(len(passkey)):
		test = j + 1
		for k in xrange(len(passkey)):
			if test == passkey[k]:
				result = result + encrypted[k][i:i+1]

print "Decrypted message is " + result

And output is: "ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemisabcdefghijklmnopqrstu"

At the end you can see padding, so answer is just: "ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemis"

Flag: "ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemis"

And the whole script, that solves task:

#!/usr/bin/env python
import string

encrypted = ["sebt", "yuwi", "ytrr", "ortl", "rbon", "aluo", "konf", "ihye", "cyog",
 "rowh", "prhj", "feom", "ihos", "perp", "twnb", "tpak", "heoc", "yaui", "usoa", "irtd",
  "tnlu", "ntke", "onds", "goym", "hmpq"]

passphrase = "yoursshallpausepeaceyears"
alph = string.ascii_lowercase
count = 1
passkey = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for a in alph:
	for i in xrange(len(passphrase)):
		if passphrase[i:i+1] == a:
			passkey[i] = count
			count +=1

print "Key is " + str(passkey)

result =""
for i in xrange(4):
	for j in xrange(len(passkey)):
		test = j + 1
		for k in xrange(len(passkey)):
			if test == passkey[k]:
				result = result + encrypted[k][i:i+1]

print "Decrypted message is " + result
Authentic Nike Sneakers | adidas
Attachments: