Code Breaking.

A short while ago I posted a quickthought that described a fantastic little article about the hidden architectural secrets that an architect put into his client’s house. The article contained the following ceaser shift cipher:

FDYDQ,WKHDUFKHU’VFKLOG;FXULRXP,EULJKW–BRXUTXLFHJLOGSLYRWVDQGOHDSVOLNHDGDOFHU.
WKHNHBWRSUHVHUYLQJFXULRXPLWB’VOLJKWLVWRORYHWKHTXHVWLRQDVPZFKDVWKHDQVZHU

I promptly started writing an excel program to help me solve it. Jesse then stepped in to help out a bit with some macro work. the end result is decidedly awesome.

Click below to download the excel sheet:

caesarcodebreak.xls

Try it out! You’ll have to use Microsoft excel and you’ll have to enable macros. But the result is a pretty sweet little program. Note: There are two sheets. the first is for all generic codes, the second sheet is specifically for shifted codes.

Surprisingly, Shamus was working on a program to solve ciphers at the same time. He did his in Labview. Check out a screenshot here.

Codes are sweet.

9 thoughts on “Code Breaking.

  • 6/18/2008 at 1:07 pm
    Permalink

    QUESTION: Did the Ctrl-M keystroke listed in the instructions on the excel sheet work for you? if it didn’t, let me know.

    Reply
  • 6/18/2008 at 1:58 pm
    Permalink

    worked for me in Excel 2007

    Reply
  • 6/18/2008 at 2:11 pm
    Permalink

    hahaha!
    Great!

    I’ve taken to working on the mathematical Car Talk puzzlers in excel as well. I’m having mixed results getting to the answer but mostly due to my understanding of the problem.

    Reply
  • 6/18/2008 at 5:12 pm
    Permalink

    Wow, now I really feel computer illiterate. I can barely use Excel, let alone write programs for it.

    Reply
  • 6/18/2008 at 6:00 pm
    Permalink

    Didn’t you post a code a few months ago, but asked that answers not be posted in the comments? Whatever happened to that, and did anyone ever get the answer? (I completely forgot what it looked like)

    Reply
  • 6/18/2008 at 6:47 pm
    Permalink

    Yes, that did exist. no one ever solved it. Although to be fair, it was very difficult. I will not reveal the answer as I know of a few people who are still working on it. If you’re interested in trying again, you can find it here:

    http://www.mikedidonato.com/2008/04/23/code-2/

    This excel program could help you solve one of the steps, but the algorithm is more complicated than a simple find and replace, so I wouldn’t recommend plugging it in and giving it a shot.

    That code is very hard.

    Reply
  • 6/19/2008 at 11:15 am
    Permalink

    I made it in Ruby; it will also guestimate the cypher shift based on the assumption that the most occurrant letter is ‘e’

    class String
    def what_does_it_say?
    decipher(find_shift)
    end
    def most_occurant_letter
    letter_occurances = Hash[*(‘A’..’Z’).collect{|l| [l, 0]}.flatten]
    self.upcase.chars.each{|c| letter_occurances[c] = letter_occurances[c] + 1 if letter_occurances.has_key?(c) }
    letter_occurances.sort_by{|pair| pair.last}.last.first
    end
    def find_shift
    most_occurant_letter[0] – ?E
    end
    def decipher(shift) # Character shift yanked from http://agorf.gr/code/rcipher.rb.txt
    upcase.chars.collect{|c| c =~ /[A-Z]/ ? ((c[0] % ?A – shift) % 26 + ?a).chr : c }.join
    end
    end

    cypher = ‘FDYDQ,WKHDUFKHU’VFKLOG;FXULRXP,EULJKW–BRXUTXLFHJLOGSLYRWVDQGOHDSVOLNHDGDOFHU. WKHNHBWRSUHVHUYLQJFXULRXPLWB’VOLJKWLVWRORYHWKHTXHVWLRQDVPZFKDVWKHDQVZHU’

    puts cypher.what_does_it_say?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *