4

The Hamming distance is more effective when you suspect that the plaintext has been XORed with some repeating keystream. That's because XOR works at a bit level, as does the Hamming distance. The Index of Coincidence is more effective when you suspect that the plaintext has been combined with some repeating keystream, where the combiner works character-by-...


3

As defined e.g. in Stinson's Cryptography: Theory and Practice (1995, 1st ed.; the earliest source for the term I could find that has even excerpts online), the mutual index of coincidence of two strings of symbols (letters, numbers, whatever) is simply the probability that two symbols chosen at random from each of the strings will be the same. The formula ...


3

I suspect, when the IC was invented, it was typically used together with human judgement, so there might not be any standard rules to address this issue. Anyway, it seems like there are two plausible solutions: It might be easy to add a special case for this situation: choose the keylength with the highest IC, except that if it has a divisor whose IC is ...


3

Just for simplicity lets assume that your short period "password" was just XORed with plaintext. So we have encryption procedure like: for(int i = 0; i < plaintext_len; i++){ ciphertext[i] = plaintext[i] ^ password[i % password_len]; } When you shift your ciphertext by password_len and XOR it with original ciphertext, you'll cancel out your password ...


2

Here $f_i$ is simply the number of times the character $i$ appears in the ciphertext of length $N$ and where $Z$ is the alphabet size. If you had ciphertext ADCXU ZMDYZ DXZUM and which was derived from English plaintext then $N=15$ and $f_A=1,f_B=0,f_C=1, f_D=3,\ldots, f_Z=2.$


1

Try tokenizing the plaintext using an English dictionary. Give higher scores to bigger words to prevent your analyzer from favoring a bunch of one to two letter words. Total the score up and take the highest. I'm not trying to plug, but there's an (badly written) example in this repo: https://github.com/wildcardcorp/samson Here's the code for the analyzer ...


1

As explained on the link you posted, the Vigenere cipher with a key on length $n$ encrypts every $n$-th symbol with the same key under the Caesar cipher. So to calculate the IC you should take all the $n$ sub-sequences separately: $\{1, 1+n, \dots, 1+kn, \dots\}$, $\{2, 2+n, \dots, 2+kn, \dots\}$ and so on and compute the IC for every sub-sequence.


Only top voted, non community-wiki answers of a minimum length are eligible