Sunday, September 28, 2014

SU CTF 2014 - Decrypt the message! write-up

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:

This is a WWII poem code encryption. more details.
The key length must be 25 characters:
yours shall pause peace years 
The flag becomes:
if you think cryptography is the answer to your problem then you do not know what your problem is
Happy hunting!

UPDATE: Balalaika Cr3w wrote cool script for the decryption phase:

#!/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

No comments:

Post a Comment