Hello,

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
then
swop b with a;
end

2) Swop pairs of values?

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

Recommended Answers

All 3 Replies

What does "swop" mean?

Swap.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.