Beta

Cracking Vigenère: unknown language

Description:

Background

Codewars nation is at war with a mysterious enemy. You are leading the security department responsible for intercepting and interpreting their communications.

Unfortunately, their language is unknown and the linguists in your department are unable to start understanding it because the enemy is also encrypting its messages.

You task is to decrypt the messages, so that the linguists can start working on deciphering the language itself.

Starting assumptions

But you are not completely in the dark! Your spies have discovered a few key facts which might help to decrypt the messages:

  • The enemy language uses the English alphabet: all messages will always use the basic 26 letters in the English alphabet, in upper case
  • The messages contain no spaces or punctuation
  • They are encrypting the messages with a Vigenère cipher (more detail below) but the key used is different for every message
  • There are 100 messages to decrypt in total and the enemy is gradually learning that longer keys are harder to crack:
    • there will be 30 keys of length 2
    • then there will be 30 keys with length 5
    • finally there will be 40 keys of lengths varying between 6 and 11
  • The enemy is planning an attack on the Codewars Headquarters and all the messages will be on the topic of that attack: therefore, every message will contain the string 'CODEWARS HEADQUARTERS' somewhere

Vigenère Cipher

The Vigenère cipher is too long to fully explain here. If you are unfamiliar, you could read the Wikipedia page or some other tutorial. There are also two other Kata which might be worth looking at before attempting this one.

Task

To complete this Kata you need to define a function which can be applied to each of the 100 enemy messages and return the encryption key used for each one.

Note: The enemy language is randomly generated each time you submit a solution. The sample sizes have been set high enough that strong solutions should pass all 100 tests the vast majority of the time. However, if your solution fails one or two tests, then you may want to re-submit. Your linguists can deal with minor inaccuracies anyway.

Puzzles
Strings
Ciphers
Algorithms
Cryptography
Security

Similar Kata:

Stats:

CreatedApr 23, 2021
PublishedApr 25, 2021
Warriors Trained26
Total Skips1
Total Code Submissions247
Total Times Completed7
Python Completions7
Total Stars2
% of votes with a positive feedback rating25% of 2
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes1
Total Rank Assessments3
Average Assessed Rank
4 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • jharris3791 Avatar
Ad