Index of Coincidence Applet 2

This applet will calculate the index of coincidence (IC) between two strings, or between one string and all possible shift encryptions (Ceasar) of another string. It will also estimate the IC of a string and that same string with its first few characters deleted (sometimes called an offset of the original string).

The IC of a string is the probability that two randomly selected charaters from the string are equal (i.e. both 'a' or both 'b', etc.).

This applet estimates that probability by aligning the two strings, character by character, and counting the number of characters that match. The count is divided by the length of the shorter string.

This applet calculates the IC between two strings by multiplying the probabilities for each letter (prob of an 'a', prob of  a 'b', etc.) in string 1, by the corresponding probability in string 2, and adding these products.

Estimates of the IC are most accurate for strings with many (500 or more) characters.

To calcuate the IC of a single string X

  1. Enter X in the X text area.
  2. Enter X in the Y text area.
  3. Press the "IC(X,Y)" button.

To calculate the IC between two strings

  1. Enter one String in the X Text Area.
  2. Enter a  second String in the Y Text Area.
  3. Press the "IC(X,Y)" button.

To Calculate the IC of X and all shift encryptions of Y

  1. Enter the string X in the top text area.
  2. Enter the string Y in the second text area.
  3. Press the "IC(X, Y-k)" button.

  4. This will then subtract k from each character of Y and calculate the IC of X and the result (for k = 0 to 25).

To estimate the IC of a String X and X offset by k = a to b characters in steps of size dx

  1. Enter your String in the X Text Area.
  2. Fill in a starting k = value (from 1 to something less than the length of your String).
  3. Fill in an ending k = value (larger than your starting value and less than the length of your string).
  4. Fill in a step size from 1 to something less than the length of your string.
  5. Press the "Est. IC(X)" button.
Here is the souce code for this applet, TrueICApplet.java, the java application source code and BreezyGUI information.