It can be proven that in order to find the best solution, you have to try at least 1,000,000 different possible solutions. The simplest kinds of encryption codes are letter substitution codes called anagrams. These are the most ancient, they are also the easiest to crack. Arthur Conan Doyle's The Dancing Men demonstrates just such a code and also how simple it is to decode. The next simplest is the word substitution.
Every word has a substitute.
These are the codes used by the Allies during WW2. Even more complicated are code word ciphers in which each letter of the text has its own code based on a code word repeated over and over. The Germans used a electronic device that would encode the messages they were sending so that each letter had its own anagram. Colossus built by the British to decipher the German code Enigma . The problem with both of these is that if you have a coded message and a deciphered message, it is rather a simple thing to reverse engineer the code.