A simple substitution experiment
#12
(17-09-2025, 12:30 PM)ReneZ wrote: You are not allowed to view links. Register or Login to view.
(17-09-2025, 11:49 AM)oshfdk wrote: You are not allowed to view links. Register or Login to view.Do I know how to identify the plaintext language given it's some simple substitution cipher?

Almost....
I meant recovering the plain text, based on some reasonable assumptions (for this case).
For example: the language may be Latin, Italian or German.
Of course, the question is extended to everyone else.

The text may or may not be too short. I can provide a longer sample to anyone wanting to give it a try.

Deciphering a simple substituion cipher is easy if the ciphered sample is long enough and one has statistics available for the possible target languages. Calculate a statistic, for instance bigram frequency, which works rather well in identifying a language. Then compare the bigrams distribution with the bigrams distributions of the target languages.

For example, here I took an Italian book ("Amore di Loredana", an old book I use for tests) and ciphered it with a simple substitution (I also substituted the character 'space'):

Quote:lnqdzchzknqdc m zcdkzldcdrhlnz tsnqdzk zbnlo fmh zcdkk zkdffdq zmnudkkdzkzk' lnqdzchzknqdc m zqnl mynzchzktbh mnzyùbbnkhzlhk mnzeq sdkkhzsqdudrzdchsnqhzoqnoqhdsàzkdssdq qh zhzchqhsshzchzqhoqnctyhnmdzdzchzsq ctyhnmdzrnmnzqhrdqu shzodqzstsshzhzo drhzbnloqdrhzk zrudyh zk zmnqudfh zdzk'nk mc zlhk mnzshozsqdudrzk' lnqdzchzknqdc m zoqhl zo qsdzhzoqdmchzptdkkdzu

Then I calculate the geometric distance (root-mean-square distance) of the bigrams distribution with those of different languages samples (DHR are the Declaration of Human Rights). These are the results, where the source text is recognized as a cipher of Italian:

   

I did not code the next step (get the substitutions tables), but it's anyway easy to do just by looking at the bigram frequencies tables (but just character frequencies would do at this point). Here the frequencies of the ciphered text are shown, together with the frequencies of a corpus of 309 Italian texts:

   

And it's easy to see that, for instance, 'space' has been replaced by 'z', 'a' has been replaced by 'space', 'e' has been replaced by 'd'.
[+] 2 users say Thank You to Mauro for this post
Reply


Messages In This Thread
A simple substitution experiment - by ReneZ - 17-09-2025, 04:08 AM
RE: A simple substitution experiment - by tavie - 17-09-2025, 07:34 AM
RE: A simple substitution experiment - by ReneZ - 17-09-2025, 08:09 AM
RE: A simple substitution experiment - by oaken - 17-09-2025, 09:49 AM
RE: A simple substitution experiment - by oshfdk - 17-09-2025, 11:03 AM
RE: A simple substitution experiment - by oaken - 17-09-2025, 11:14 AM
RE: A simple substitution experiment - by oshfdk - 17-09-2025, 11:46 AM
RE: A simple substitution experiment - by ReneZ - 17-09-2025, 11:45 AM
RE: A simple substitution experiment - by oshfdk - 17-09-2025, 11:49 AM
RE: A simple substitution experiment - by ReneZ - 17-09-2025, 12:30 PM
RE: A simple substitution experiment - by Mauro - 17-09-2025, 01:09 PM
RE: A simple substitution experiment - by oshfdk - 17-09-2025, 02:12 PM
RE: A simple substitution experiment - by ReneZ - 17-09-2025, 11:25 PM
RE: A simple substitution experiment - by RobGea - 17-09-2025, 03:15 PM
RE: A simple substitution experiment - by ReneZ - 17-09-2025, 11:29 PM
RE: A simple substitution experiment - by RobGea - 18-09-2025, 03:30 AM
RE: A simple substitution experiment - by oshfdk - 18-09-2025, 10:44 AM
RE: A simple substitution experiment - by ReneZ - 18-09-2025, 10:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Have we ruled out simple substitution unwisely? eggyk 46 13,922 11-02-2026, 09:47 AM
Last Post: Aga Tentakulus

Forum Jump:


Users browsing this thread: 1 Guest(s)