Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let say that I wrote a 26 letter alphabet, each letter of my alphabet represent a letter from the latin alphabet.

I'm writing in 3 languages, only I know which languages. Grammar is the one from my native language.

Each time I need to write a word I randomly chooses in which language I'm going to write it.

Can you actually break this code using Frequency analysis?


example :


The sentence :

this is a cherry tree

becomes :

ceci is a sakura

[fr] [en] [en] [jp]

and once encoded :

cfch gi x oxirax
share|improve this question

migrated from Jul 21 '13 at 13:59

This question came from our site for scientists using computers to solve scientific problems.

I can probably break it by using Google Translate to translate each word into English. It's pretty good at auto detecting the language of a word. – Bill Barth Jul 19 '13 at 16:42
Given the issue of "break[ing] this code using Frequency analysis", I suspect the OP means that a substitution cypher is to be applied uniformly to the words, regardless of which language they are from. It's unlikely Google Translate could reliably detect the language from such encoded words. – hardmath Jul 19 '13 at 17:04
Could be, but "Each time I need to write a word I randomly chooses in which language I'm going to write it." seems to imply word swaps not letter swaps. Perhaps @sliders_alpha can clarify. – Bill Barth Jul 19 '13 at 19:49
I'm not sure this question fits well into SciComp. Or rather, I don't know that many current SciComp users will answer this question, and you might be able to get a better quality answer at Crypto.SE. – Geoff Oxberry Jul 21 '13 at 8:42
@Bill Barth it's word swaps and letter swaps – sliders_alpha Jul 22 '13 at 8:22
up vote 5 down vote accepted

Yes, we can almost certainly break this, given enough ciphertext.

One approach would be to use a dictionary and use word patterns. For instance, if the ciphertext word is qddxfozogf, then the plaintext word was probably ammunition. Notice how the 2nd and 3rd letters are the same; and the 5th and 10th letters, and the 6th and 8th letters? The word ammunition is essentially the only word that has this special pattern. One could expect that some fraction of words will be essentially unique, in their pattern of repetition. With enough ciphertext, you'll be able to uniquely recover one or more of the words, and then the rest of the cipher will be easy to break.

Frequency analysis will also almost certainly be possible. For instance, the letter q occurs with frequency 0.1% in English, 0.02% in German, and 0.9% in Spanish. In contrast, the letter e occurs with frequency 14.7%, 17.4%, and 13.7% in English, German, and Spanish, respectively. Therefore, if you choose uniformly at random between English, German, and Spanish, the letter q will occur in the plaintext with frequency about 0.3%, while the letter e will occur with frequency about 15.3%. Notice how e is still much more common than q? This indicates that frequency analysis remains possible. (Wikipedia has data on the frequency statistics of different languages.)

Digraph analysis (the frequency of pairs of letters, like the pair th or qu) will also almost certainly be possible.

Finally, there are more sophisticated methods for cryptanalysis of simple substitution ciphers, such as hill-climbing. These methods will almost certainly be effective at ciphertext-only cryptnanalysis.

And the cipher will completely fall apart in the presence of known plaintext (let alone chosen ciphertext).

TL;DR: Your proposal is highly insecure. Don't use it.

share|improve this answer
Quite clever. however could it be possible to avoid thos "unique word" detection by using more than 26 letters? For example mm could become a new letter (all double letter) – sliders_alpha Jul 22 '13 at 8:30
@sliders_alpha: That idea was explored in classical cryptography as well (see polygraphic substitution). Ultimately, it all fell to cryptanalysis. If you're interested in learning more about classical cryptography, I'd recommend The Code Book by Singh and The Codebreakers by Kahn. – Reid Jul 22 '13 at 17:17
Averaging the letter frequencies of each combination of three languages should also yield a series of unique profiles. But to actually make use of them will require a large amount of ciphertext written in the same manner as sources from which the frequency tables were generated. It's not impossible, it will just take 364 times more ciphertext than a single language (number of combinations of 3 of 14 languages). – John Deters Nov 17 '13 at 23:40

All natural languages use some symbols more than they use others (or maybe not? Is there a linguistics expect among us to correct me?).

Therefore, if your cipher doesn't mask the frequency of the characters (eg. a simple permutation or substitution) then you are vulnerable to frequency analysis. Perhaps Chinese is somewhat resistant to this but still vulnerable.

However, since you are using the Latin alphabet for all languages, I don't see how you gain any advantage by mixing them up. The only disadvantage goes to the receiver who (potentially) has to use a dictionary to see what you mean. So can the attacker.

Your system does provide some degree of obfuscation but there are only so many languages using the Latin alphabet. If you use a single language for the entire message, the cipher can easily be broken. If you use a different translation for each word in the message you may complicate things a bit but you don't gain any real advantage.

share|improve this answer
I'm using the latin alphabet but not only latin languages. – sliders_alpha Jul 22 '13 at 8:31
"I don't see how you gain any advantage by mixing them up" you don't know what language has been use for a particular word. therefor you can't calculate the frequency of apparition. – sliders_alpha Jul 22 '13 at 12:26
you can't calculate the frequency of apparition but you can see such a frequency exists. This is an interesting question and an algorithm which cracks the scheme you propose is definitely something I'd like to see. – rath Jul 22 '13 at 13:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.