title: Vigenere/Polyalphabetic Cipher Decoder/Decrypter/Breaker in Java
body: <p>I am trying to develop a program that encodes, decodes, and breaks the encryption for a message encoded with a Vigenere cipher. Where I am getting stuck is breaking [the encryption on] the message (without the key). I have an idea of how to go about doing it, but I'm not sure how to code it. My idea is a follows:</p>
  
  <p>The program would systematically generate potential keys, with a length starting at 1 and ending at 26. The keys would contain the letters of the English alphabet and are NOT case sensitive. For each key length (anywhere from 1-26), the key would be filled with the letter 'a', and then the program would check to see if they key was corrent (I have another method for that). If they key was incorrect, then the letter in the last position would be rotated to the next letter in the alphabet. Once the last letter had gone through all 26 possible positions, the second to last letter would be rotated, and then the last letter and the second to last letter would rotate accordingly, and so on a so forth (all the way back to the first letter of the [potential] key). Each time a new key is generated, the [potential] key is being checked with a separate method, and the method stops when the correct key is found. The key creation progression would go something like this:</p>
  
  <pre><code>[starting with keys that are only 1 letter long]
  a
  b
  c
  ...
  x
  y
  z
  
  [now the potential key length becomes two]
  aa
  ab
  ac
  ad
  ...
  zw
  zx
  zy
  zz
  
  [eventually the potential key length becomes 26]
  aaaaaaaaaaaaaaaaaaaaaaaaaa
  aaaaaaaaaaaaaaaaaaaaaaaaab
  aaaaaaaaaaaaaaaaaaaaaaaaac
  aaaaaaaaaaaaaaaaaaaaaaaaad
  ...
  zzzzzzzzzzzzzzzzzzzzzzzzzw
  zzzzzzzzzzzzzzzzzzzzzzzzzx
  zzzzzzzzzzzzzzzzzzzzzzzzzy
  zzzzzzzzzzzzzzzzzzzzzzzzzz
  </code></pre>
  
  <p>(hopefully you can see the pattern there)</p>
  
  <p>If anyone has or knows the code for how to do this, or could help guide met through the steps necessary to code this, it would be much appreciated.</p>
  
  <p>Thanks!</p>