Code Breaker


The Message

From the time of Alan Turing and the codebreakers of Bletchley Park to today, computers have been closely tied to secret codes and cryptography.  In this Code Newbie Challenge, we will be using our computers to decode the following secret message:

pbqrarjovrf ner gur zbfg fhccbegvir pbzzhavgl

The Decoder Ring

Luckily for us, we don’t have to crack the Enigma code to read the message. We have a key that will translate the message back into readable English.  Each letter in the message above has a matching decrypted letter in the chart below:

Encoded

n

o

p

q

r

s

t

u

v

w

x

y

z

a

b

c

d

e

f

g

h

i

j

k

l

m

Letter

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

x

y

z

Example: Using the chart above, the code “gur” becomes the word “the”.

The Challenge

This challenge has three levels of difficulty.  Each successive level requires some additional work to complete.  You may select the difficulty level that is right for where you are on your coding journey.

Level 1 - Write a program to decrypt the secret message above.

Level 2 - Complete level one and update your program to create secret messages from the following phrases:

  • no one can read this secret message
  • it is so super secret
  • only a CodeNewbie can figure it out

The following chart shows how to convert the letters in the phrases to a secret encoded message.

Letter

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

x

y

z

Encoded

n

o

p

q

r

s

t

u

v

w

x

y

z

a

b

c

d

e

f

g

h

i

j

k

l

m

Level 3 - Complete levels one and two and also try using uppercase letters with your program, do they work as expected? If not, modify your program so it can encode and decrypt, regardless of the capitalization.

Stretch Goal

This encryption scheme is known as ROT13.  After learning a little more about ROT13, are there any changes that could be made to your code to improve it?