In history class, we are covering WW2. On the topic of code-talking, Native American language usage was mentioned, but nothing was said about cryptography. An online search did not come up with any clear information relating the two topics. Why was the use of Native American languages the preferred method of code talking? Was cryptography crack-able, so not used?
In WW2 we didn't have digital computers. We didn't even have transistors. Even vacuum tubes were state-of-the-art. If you wanted to do cryptography on the battlefield, you used something like this Enigma machine.
Basically a fancy typewriter, it did all its encryption with gears and wires. If you wanted to send a message your radio operator had to check your code book for the daily key. Then come up with a key prefix. Then you either wrote down the message or dictated it to them. They typed it in and wrote down the result one letter at a time. Then they got out their radio and sent it via Morse code, probably the fastest part of the whole procedure. Though flawed, it was pretty good cryptography for the time and took an enormous effort to crack.
This is all fine if you're a division commander safely behind the lines in your command vehicle, but if you're a platoon leader on the front lines getting shot at, lugging around an oversized typewriter is a bit slow and cumbersome. Not to mention a radio operator and precious code books that you don't want falling into the hands of the enemy. Even having a radio was a luxury in WWII.
If you were in the US army, and you were really lucky, you might get one of these...
While it was capable of sending Morse code, operators obviously preferred voice. If you thought encrypting Morse code with a typewriter was bulky, slow and impractical, if you wanted to do voice communications you used this.
Say hello to SIGSALY! Weighing in at a mere 50 tons and using just 30kW of power. SIGSALY essentially added and then subtracted pseudo-random noise from the conversation using vinyl records as a one-time pad. A set of those records had to be distributed to all users worldwide.
With all that in mind, finding some guys who speak a language your enemy doesn't understand makes a lot more sense.
It wasn't just Navajo who were code talkers. Cherokee, Choctaw, Lakota, Comanche... even Basque was used. Any language it was unlikely the enemy knew or even had books for. Even Pig Latin could be effective at confusing a non-native English speaker trying to make out a message over a crackly radio.
While this was security-through-obscurity, that worked a lot better back in WWII. Tactical radios had a very short range, a few miles, so it was unlikely anyone in range knew the language and it's not like they could order a Navajo-Japanese dictionary on Amazon. Since it was voice, and recording equipment was bulky and expensive, it was very unlikely anyone in range could record it for later analysis. Even if they did, it was used to transmit tactical information; by the time it was decoded it would be useless.
One of the myths about the Code Talkers, at least the Navajo, was that, at the time, they had no written language and thus you couldn't learn it without a native. This was not true.
Instead, the written language began as various transcriptions either to provide information to US military scouts, or more often for missionaries. In 1917 a Bible was published, God Bîzad, which featured a transcribed alphabet, basic pronunciation guide, and basic word examples. In the 1930s and 40s the Bureau of Indian Affairs developed a unified written language. By 1943 you could get a dictionary and grammar guide, The Navajo Language. You could even get a typewriter with Navajo characters and a newspaper, Ádahooníłígíí.
"The Code Book" of Simon Singh mentions several points why code talkers where so useful.
Speed: One of the colonels in charge tried exactly that: code machine against Navajo code. The Navajo was able to talk in real-time, while the machine fall hopelessly behind - very important during tactical situations.
Strength of code: The Navajos was one of the few tribes which had had no contact with enemy anthropologists. Their language, Diné bizaad, belongs to the Na-dene isolated family of languages, Those languages had a very unusual flexion pattern and Diné bizaad was even inscrutable for other tribes. The best decryption team of the USA who were able to crack the Japanese PURPLE code were speechless when confronted with the Navajo language. Because the tones were completely different from anything with the usual A-Z, they could even not transcribe or differentiate the phonemes.
No access point: In the former edit I said that the Navajo had no writing system to transcribe their language. Schwern pointed out that there were a Bible translation and later an unified writing system, but (and this is critically) the first unified system was not developed before 1935, meaning it was not available for the Navajos working as codetalker. The Navajo were used to learning everything by heart and so there were no codebooks which could be stolen, copied or captured. Even if the enemies captured one talker and that talker tried to teach the language, it would have taken years for someone to master the language.
Security and Authentication: Not only was the information protected, it also clearly identified friend and foe. The enemy could not create disarray or confusion by fake transmissions. While using other languages like Pig Latin or strong dialects in the heat of the battle give some protection, they can be recorded, analyzed later and transmit valuable information about the tactics and strategy.
Code talking in an obscure language puts two layers of encryption on the message. The first layer is that it's a language. The second is that it's a code. The code part is usually pretty simple with code words replacing the real words. The phrase "Omaha beach" is simple code. The place we called Omaha beach probably has an actual name in French or German. Oral codes based on simple word substitutions are easy to crack, given enough coded messages, and some inkling of the underlying subject matter.
Deciphering an unknown language is enormously difficult, even after you realize that it is a language. It can take months to figure out the variations in normal speech. For example, verb tenses might work differently in Navajo language than in English or German. Word order might be different, and in a context dependent way. To a native speaker, this transformation is easy to do in real time, without much mental effort, except when some concept is difficult to convey. The military messages in the field are usually easy to convey in another language. They involve place, time, and action.
So what you get is a high cost on the would be interceptor and a low cost on the encoder-decoder team.
The wikipedia article (see Code Talker) mentions the two layers in passing. It also provides more details, like what languages other than Navajo were used.
EDIT: This edit is based on some of the commentary on the other answers. When I wrote my answer, I assumed that the Japanese (I guess the Navajo code-talkers were used in the Pacific) would have to learn the obscure language on their own, without reference to prior research on the Navajo language. Some of the other answers have asserted that there was plenty of research available, including dictionaries. I still think that research would have been very, very hard for the Japanese to put their hands on in the middle of a war.
Still, I have to admit that this is a case of security through obscurity, albeit a very though case to crack. I still think it was a better plan than the alternatives, in the wartime theater where it was used. It was quick to set up, and gave the US a longer period of safe communications through field radios than any viable alternative. And, as I said, the cost on the US coders was low, while the cost on the Japanese crackers was high.
The need to keep mission assignments encoded and unreadable for the enemy is at times called "information warfare" or in today's military "electronic warfare", "EloKa" (german for Elektronische Kamfgruppe) and by many different terms. It has its root very much in the World War II and what the military had learned in WW I. So a quick look back:
During the first World war, there was little to no radio setup and messages were sent by field telephones (with cable!) and morse (cable too!) to and from the trenches and then distributed by messengers on foot or horse. To keep the vital information unusable by enemies, encryption was usually done with a code book that contained the clear words and the code words.
However, the day to day status reports at the front usually went along unencoded, especially since the language barrier between French/German, Russian/German and English/German combatants. For example in the German Army it was much easier to find a soldier that spoke fluently greek or latin (because he had visited a humanistic gymnasium where that was part of the curriculum) than someone who was equally good in English or spoke a decent French. Still, there were these people, but not in a number large enough to compromise day to day messages that fell to enemy hands, and thus made cryptography a thing for very secure messages.
Also, decoding and encoding took quite some time, but it was pretty much doable "in time" to respond - at least for diplomatic messages. One of these messages was the Zimmerman Telegram .
Unlike in WW1, communications equipment had improved a lot. Radios were no longer huge stations that could relay information cross country on their own, they had become quite transportable - about the size of a backpack or large typewriter, and even some smaller at times. However, WW1 had also proven, that just using code booklets was no good way to bring along messages, and in the time between the wars "Electromechanic" systems like the German Enigma had been developed, that made encryption and decryption much faster with the machine, if you knew the codebook.
This encryption method proved to be failsafe against decoding by hand, however, the Allies managed to reverse engineer quite some about the machines, even without decoding the messages properly. For example, it was known quite some that the encrypted messages themselves had to begin with a very specific block, which at least allowed to cut down the possibilities: there were only 6 ways how the initial 3 rotors could be assembled and so it was pretty possible to find the right code with a device called "Bomba", which just tried to find the right order (1/6) and then the right starting letters (1/26)³. This would get the right message on the first try with a chance of 1 in 105,456, speeding through all of them within hours. Still, that was a pretty time-consuming process, but it worked pretty well for the Polish Army until 15th December 1938. On that day, new wheels threw off the decryption process and made 56 out of 60 messages illegible to them, even if they reverse engineered the new wheels pretty fast - the chance had fallen to 1 in 1,054,560 to decipher the code with the first try and thus decoding time went through the roof by a factor of 10.
With the new wheels, the possible combinations became much more than anyone could handle by hand, and so the British MI1 at Bletchley Park stepped in. They built just another machine, that would try about every single possibility. The British "Bombe" it was much bigger and ran through a lot more combinations, day and night than the Polish predecessor. it was only needed for one machine to find the right set of wheels and start setting, and subsequently have an other machine decode the messages of the day automatically.
It became pretty clear to the Allies, that the Germans did not know that by September 1939 their communication had become as good as clear text (with only some hours delay) to the Allies. But it was a good possibility that the Germans would develop something similar to their own decoding machines if they would rely on a similar device. Also, they figured out, that the knowledge of English, Russian or French language was much more widespread in Germany than in the war before. So there had to be done something to keep the german intelligence from discovering tactics. To achieve this, encryption by using an obscure language set was chosen. How this happens can be pretty well seen in Schwern's answer.
Firstly, the Code/Wind talkers were used almost exclusively in front line tactical units. This meant they communicated via very short range walkie-talkies or land lines.
The walkie-talkies had short range e.g. <3 miles in optimal conditions. Given the mountains and jungles of the pacific war, the walkie-talkies could usually reach the company HQ and not much else. Front men at the front could reach their first level of command, maybe. The whole one guy with a walki-talkie calling out to battleship miles off the coast for air support is pure Hollywood.
Land-lines, telephones, were far more common and reliable but easily tapped. In some versions, which the German made heavy use off, the return circuit was actually the ground itself, making tapping just a matter of getting withen a few yards/meters with a probe.
In tactical situations, minutes count, so encryption devices or code books were so slow to be useless. Besides, code books and gadgets were easily captured as each side raided the other constantly expressly for prisoners and intelligence.
The Japanese learned a lot of Navajo very quickly by the simply expedient of capturing Wind-talkers and torturing them or, as was more common, other prisoners. Stoic Navajo Marines could stand a lot of pain themselves but broke watching the Japanese set their fellow marines or local civilian children on fire.
(The pacific island war was "War to the Knife" as the Japanese broke almost every conceivable law, rule or custom of civilized warfare and the allied forces of Americans, Aussies and Kiwi soon learned to give as good as the got (which the Geneva convention allows.) Which is why thidea that U.S, soldier cracked in Vietnam is so silly. Their father's had fought through much more worse for much longer... but I digress.)
What made their verbal communications the most opaque was their use of metaphors and illusions rooted in the culture and environmental experiences of Navajo people themselves. The used the behavior of animals, weather, terrain, culture and religion, often hastily converted into an ever evolving code,e.g. one week using rabbits to mean speed but using them to mean slow the next. That made their dialog unintelligible not only to the enemy but even to captured Navajo tortured into attempting decrypt the intercepted dialog.
The controlling factor though was the pace of tactical combat. Given weeks or months, any verbal code could be cracked but the Japanese only had hours or days at most to make use of the intelligence because it because useless as the tactical situation changed.
They Code/Wind talkers were only the most famous of those who founds means for secure ad hoc communications. America had a vast "toolkit" of many subcultures many whose speech proved almost unintelligible to anyone one else. The Navy used back-hills Southerns, both white and black to communicate in their drawling, metaphor chocked dialect. In one case, two Italians appeared to sing drunkingly across a land line assumed to be trapped, and no one, not even other Italians could understand them.
In my favorite trick, they had Japanese-Americans simply babble across compromised lines in slang ridden Japanese, causing the Imperial Japanese to waste a lot time trying to make sense out non-sense.