Can you decrypt this message?
So the hint is that the message is encrypted with a Vigenere cipher using the key CYLAB
. Sure we could use an online tool, but how about in python?
The way a vigenere cipher works is that the letters in the key are converted into integers based into their position in the alphabet, with 0
being a
and 25
being z
. Those values are then used as shift values for a per-letter caesar cipher - so in the case of CYLAB
, the first value is 3
and the second is 24
. Given the encrypted flag:
We then know that r
is the plaintext letter shifted over by 3
and g
is the plaintext letter shifted over by 24
(and looped around, in the same way a caesar cipher is). To this end, we can make a quick script:
We get the output
Which isn't quite the flag. Evidently, it's working.
After a lot of trial and error, it turns out that the problem is that we are looping throuhg them at the same pace, but in reality the key isn't even being incremented on the non-letter characters (for example the L
in the key
aligns with {
in the message
, nothing is done because it's not a character, but the loop still goes on to the next key character for the next decryption). In essence, we have to just stop the key from looping on those characters: