decrypting a Caeser cipher

.
Last edited on
Any suggestions would be appreciated. I can explain the problem in-depth if you guys need it.
Can yo guys help me with how can I move on to guessing the shift by letter frequency?
For example this:

https://en.wikipedia.org/wiki/Letter_frequency

For short texts this is not that reliable though.


Additionally take a look at the most frequent words used:

https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists

You might look if you find the combination of this frequent words with a space before and/or after.
Last edited on
@coder777

You're right. I will need to do some search for the shift but I don't want it to be an exhaustive search or brute force (26 attempts).

Also, this is not going to be for short texts. It's meant to be for long paragraphs that adhere to that letter frequency you linked from Wikipedia.

I am just having difficulty in doing that using std::map.

I have the idea in my mind.

1. find most frequent letter
2. calculate its difference from most frequent letters in English (e, t, a, o, i, n, s...etc)
3. switch every letter in the word back to where it was
4. check if words == words from original text using dictionary.

I got part 1 done and I can do part 2.
but I don't know how I would do part 3.
Last edited on
3. switch every letter in the word back to where it was
You mean the calculation?

If you have a shift -> 3

The first 3 [shift] letters

'A' -> 'X'
'B' -> 'Y'
'C' -> 'Z'

'Z' - shift + ('A' - letter)

otherwise

letter - shift
I didn't understand your explanation. Can you elaborate more please?
Sorry for the late reply. What is the problem?
Topic archived. No new replies allowed.