I'm doing some work on Frequency Analysis and decrypting text..

Basically, this is how I think it works...

You take the alphabet (as a char)

alphabet[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

Then you read in the string you want to analyse

crypt[26] = {'c', 'a', 'b', 'e', 'f', 'f', 'a', 'a'};

Then you calculate how many times each character is used. e.g.
a = 3;
b = 1;
c = 1;
e = 1;

What you do after that is confusing me.. So do you:

1) Swop the values according to how frequent they are displayed in the alphabet? e.g.

if b was most frequent in the alphabet
swop b with a;

2) Swop pairs of values?

I'm really confused and looking for some guidance, thanks :)

5 Years
Discussion Span
Last Post by firstPerson

Thats one approach.
1) You calculate the frequency of each letter in the ciphered text.
2) You have a frequency map for the english text
3) Get the highest frequency character in the ciphered text, and replace it with the highest frequency character in the map form step 2.
4) Then repeat step 2 for the next highest occurring character and so on...

Note you can also do this on a word based approach instead of letters or mix-and-match both styles.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.