Chi-squared test
A statistical test that compares observed letter counts with expected ones, used to judge whether a text resembles a given language.
Karl Pearson described the chi-squared test in 1900 as a general method for measuring how far observed counts deviate from expected ones. In cryptanalysis it compares the letter distribution of a ciphertext with that of a known language. A low score means the distribution resembles the language; a high one means it does not.
Applied to a Vigenère cipher, the test ranks candidate keys: for each possible shift, it measures how well the resulting distribution fits English, and the lowest score points to the likely key. It refines frequency analysis, but it needs long texts and clean data, and short messages give unreliable numbers.