I want to write a program to break vigenere cipher. I understand the logic how it is encrypted and decrypted. I want to find the key. By using IC and Kasiski method, I am able to find the key length. But after that how do I programmically find the key? I just need to know what is the logic or math formula to do it... Any clues?