Monday, 21 January 2013

Hundreds - Next Riddle (59)

From my sources online, I determined that this riddle was a Vigenère cipher. Vigenère ciphers are similar to Caesar ciphers, except instead of the contacts 3 character shift, it has a shift that is based on a keyword. The keyword is repeated until it is the same length as the text to encode.  i.e. If LEMON was the keyword, you would repeat it like so


for a message like


Then, you take the location of each letter in the alphabet and add them together to get the new letter (it's explained more complexly on wikipedia, but this is what it boils down to). This would produce the following secret message:


Thus, to decode one of these, you simply need a keyword, and subtract the keyword's letters from the encoded message's. This is the ruby script I wrote to do this:

file ="vigenere.txt", "r")
cypher = file.gets

$key = {}
keyword = ARGV[0]

$letterArray = ["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"]

string = ""
count = 0
cypher.each_byte { |i|
   if(i.chr == " ")
      string = string + " "
      keywordLetter = keyword.split('')[count%keyword.length]
      offset = $letterArray.index(keywordLetter)
      index = $letterArray.index(i.chr)
      string = string + $letterArray[(index-offset)%26]
puts "\n"+string+"\n\n"

The script takes a single argument, which is the keyword, and tries to decode the message. With that taken care of, all that was left was to guess the keyword. Judging by the previous messages, the keyword had something to do with a harp or a chord or something. I tried pretty much everything I could think of, and then tried RADIUS after looking at the cipher's achievements page. The secret message:

Being part of a bad riddle that nobody cares about.

Tuesday, 8 January 2013

Hundreds - Next Riddle (45)

This riddle looked more like the third riddle, where letter substitution was necessary. With my handy script, I began substituting letters for short words until they made sense. Pretty soon the solution popped out: "What do persistence and a golden harp have in common". Looks like the riddles are related somehow...

Hundreds - Next Riddle (31)

The next riddle wasn't too difficult. I simply went through all the letters one by one and filtered them into columns. Turns out 4 columns is the magic number. Reading down the columns revealed the answer.

Monday, 7 January 2013


Hundreds is a neat new game for iOS where you touch floating circles in an effort to bring their total up to 100. throughout the gameplay, random messages will appear on the screen. These messages are riddles and cyphers which you're expected to solve for the prize of achievements in Game Center. The first one is the only one that's immediately readable: "A mouse has one snout but a hand has five". After touching the screen with 5 fingers, the first riddle was solved. Easy enough. The rest of them, however, aren't even readable.

The second riddle mixed up the letters in each word, so each word had to be unscrambled. There were a few 9 letter words which took a while, but it was eventually solved. "Persistence without patience is a golden harp missing its chord". So these are probably going to require a bit of patience from here on out.

The third riddle (the furthest I've gotten so far) looked like a cypher. Letters looked grouped together alright, but the proper letters were not contained in each word. Being the programmer that I am, I set off  writing a script to help me.

I started off with two arrays of letters; one for the keys and one for the values. As I made a guess at a letter key pair, I would remove them from their respective lists, and then randomize the rest of the pairings every second, printing the potential sentence to the screen.

As you can see, this wasn't going anywhere very fast. But, subbing x for a, o for r, and l for o got me the first four words. Slowly over time, I kept making letter substitutions that seemed logical. The script started to become quite useful in seeing the currently deciphered letters, and possibilities for other letters. Eventually, I reached the end:

No idea what it means, but it works. Only when I went to input the letters into the game did I realize that the cypher was simply the current letter plus 3. So the script was kind of overkill. But it worked!

Below is the next riddle. I will make another post when I solve that one, but it might take me a bit longer...

Here's the ruby script I wrote quickly. Feel free to use it to make or break cyphers.

file ="cypher.txt", "r")
cypher = file.gets

$key = {}

def randomizeKey()
  keyLetters = ["d","g","h","n","s","t""v","w","y"]
  letters = ["b","j","g","k","q","v","w","y","z"]
  $key["x"] = "a"
  $key["k"] = "n"
  $key["q"] = "t"
  $key["e"] = "h"
  $key["b"] = "e"
  $key["o"] = "r"
  $key["l"] = "o"
  $key["f"] = "i"
  $key["c"] = "f"
  $key["r"] = "u"
  $key["z"] = "c"
  $key["m"] = "p"
  $key["p"] = "s"
  $key["i"] = "l"
  $key["j"] = "m"
  $key["u"] = "x"
  $key["a"] = "d"
  $key[""] = ""
  while(letters.length > 0)
    keyIndex = rand(keyLetters.length)
    valueIndex = rand(letters.length)
    keyLetter = keyLetters[keyIndex]
    valueLetter = letters[valueIndex]

    $key[keyLetter] = valueLetter




  string = ""
  cypher.each_byte { |i|
    if(i.chr == " ")
      string = string + " "
      string = string + $key[i.chr]
  puts string