Zephyr #1

8 Responses to “Zephyr #1”

  1. john says:

    Using a “Vigenère cipher”:


    crypt='GLMNAGULTCCSLEEVNEZTNMXQTBNPOTMDVKVXEFVLZPPGULNNLYZRNKGAZP'
    from itertools import cycle
    ''.join([ chr(ord('a') + (ord(l) - ord(k)) % 26) for (l,k) in zip(crypt, cycle('NEILARMSTRONG')) ])

    Gives me:


    'thecapitaloffranceihvtgcgvalgimmjscgqspyvhegdzvuukmlagypzy'

    But then trying to feed PARIS in as another key, or adding it to existing key doesn’t seem to yield much.

  2. duncanj says:

    Very good, but you should chop off the question part before decrypting the remaining code.

  3. john says:

    Ah, of course. So in that case:


    crypt='GLMNAGULTCCSLEEVNEZTNMXQTBNPOTMDVKVXEFVLZPPGULNNLYZRNKGAZP'

    from itertools import cycle

    def vigenere(crypt, key):
    return ''.join([ chr(ord('A') + (ord(l) - ord(k)) % 26) for (l,k) in zip(crypt, cycle(key)) ])

    res1 = vigenere(crypt, 'NEILARMSTRONG') # THECAPITALOFFRANCEIHVTGCGVALGIMMJSCGQSPYVHEGDZVUUKMLAGYPZY

    res2 = vigenere(res1.replace('THECAPITALOFFRANCE', ''), 'PARIS') # THELONGESTRIVERDCPIAAYEZMRDINCFKVDIRYYRG

    res3 = vigenere(res2.replace('THELONGESTRIVER', ''), 'NILE') # QUEENSNAMEGZVFRBXNSEEQNNT

    res4 = vigenere(res3.replace('QUEENSNAME', ''), 'ELIZABETH') # CONGRATULATIONS

  4. duncanj says:

    Well done. :-) I’ll have to think up another one. How hard do you think these would be to crack without knowing the answers?

  5. john says:

    Without knowing the answers it’d be fairly tricky I guess, though the fact the answers tend to be words or names would make brute-forcing things a possibility. Plus it looks like the vignere cipher has weaknesses that are well know:

    http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher#Cryptanalysis

    Basically the repeating key is the weakness.

  6. duncanj says:

    It seems to be that the key doesn’t repeat very often over the plaintext question before it starts to repeat over the next block of ciphertext, hence frequency analysis doesn’t have much to go on. It would be even stronger if the keys were generally longer. The brute force approach might produce good results though – unless the questions or keys were not normal english words, which they need not be.

    There must already be a name for this kind of cipher/puzzle – I can’t have invented it first. :-)

  7. john says:

    Except that the cypher is commutative, so basically you’re just making a very long key. It’s much the same as if you just applied the vigenere cypher on top of itself, but in this case it’s shifted along.

    So for example to decrypt the first two parts you could use this key:

    NEILARMSTRONGNEILAGMJBJDNXVWXLRZE

    Which is attained by inverse decrypting RMSTRONGNEILARM using the 2nd key PARIS (adding rather than subtracting modulo 26). This give you:

    THECAPITALOFFRANCETHELONGESTRIVERXRPTFEZHWYSHFAJDNZLBBFRWC

    The same process could be applied to create a key that would decrypt the entire message in one go.

    So assuming the various keys line up right and don’t overlap you could end up with a single key that’s the length of the encrypted text (with no repetition). I believe if you were using a one time pad etc then it’d be impossible to decrypt a vigener cypher with a key as long as the message (that was suitably random), as there’d be no repetition. Not 100% sure about that though (never do cryptology alone).

    Though of course as the message itself contains clues to it’s own decryption it’s definitely more of a puzzle than a cypher…

Leave a Reply

Dansette