Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I am writing a program which will use Chi-Square to determine which is the correct keyword for a ciphertext via Vigenère cipher.

I came across a website that describes the Chi-Square statistics in a rather simplistic manner and had also written some code to achieve my goals. However, the actual keyword does not seem to be the lowest chi-square value as according to the website. I'm not sure if the method as describe is correct or not.

Below is the weblink: http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/

Would someone be able to provide some advice on this?

share|improve this question

1 Answer 1

This method isn't deterministic. That is, just because a keyword has the lowest chi-square value, that doesn't mean it's the keyword. All it means that there is a good chance that it is the keyword. It's not a guarantee. You should look at the first several likely options to see if the keyword lies there. If you want to automate this, you could compare the possible keywords against known words using some dictionary file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.