HackDatKiwiCTF 2015 - Vigenere 1 / 2Category: writeups
Tags: crypto kiwictf-2015
Vigenere 1 / 2
Crypto - 50/80 Points
Vigenere is a classic cryptographic cipher. It is very simple, yet not that easy to break. Unless you break Vigenere on your own, you can’t call yourself a cryptanalyst. Start with the simplest mode, Chosen Plaintext Attack:
So you got crypto skills, right? Try it again on Known Plaintext Mode:
In Vigenere 1 we had a Chosen Plaintext, where you give a plain text input and the webpage return the ciphertext. The solution is very simple. In the default Vigenere alphabet, “A” is the Reflecting character so a plaintext of “AAAAAAAAAA” returns the key as ciphertext.
The key was “KIWIKI”, it was repeated but that’s how Vigenere so you take the shortest non-repeating key.
In Vigenere 2 we had a Known Plaintext, where you know both plaintext and it’s ciphertext. You can do this by hands but I made a simple script that can do this for you.
baseAlphabet = ('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') plainText = raw_input("Please enter the plain text\n") cypherText = raw_input("Please enter the cypher text\n") key= i=0 for plainTextChar in plainText: pkey = baseAlphabet.index(plainTextChar.lower()) ckey = baseAlphabet.index(cypherText[i].lower()) key.append(baseAlphabet[ckey-pkey]) i=i+1 print ''.join(key)
The key was “XEROX”