When fighting a war, cold or hot, you try to anticipate what the enemy is going to do. What, however, if you already knew what they were doing? What if you were able to decipher their messages and know their plans in advance?
This of course leads to problems — what if they know you know? They'll change their codes. Therefore, you must be very careful- you can't, for example, just attack a ship because you know it's going somewhere- the other side might work out that the only way you would know is if you are...
Of course, stuff is still subject to interpretation.
Cipher machine theft is also a common plot in espionage, provided you are able to cover up said theft.
- Y: The Last Man. In Paris, Alter is seen going through the mail to find the last "male".
- In V for Vendetta, V hacks Fate, the government's central supercomputer (and, incidentally, the love of the villain's life). He uses it to access both their surveillance systems and the freaking postal system in order to bring down the corrupt regime. Unlike the film, the postal system stuff was just to flip the bird at the establishment by showing them he was not only in their systems, but able to control them.
- A Diplomatic Visit: Played with. The wolves of the Packlands check incoming and outgoing mail at the borders, but it's less to read the contents and more to check for potential hazards, such as explosive or poisoned letters. In chapter 25, Twilight does get one past this security measure, but that's because Wise-Mind marked it with his seal to let it go past.
- In the 1983 film Enigma, Martin Sheen plays a CIA agent who must steal a Soviet scrambler from East Berlin. The CIA already have one- this is just a Batman Gambit to convince the Soviets they don't.
- The main reason for wanting to attack the titular submarine in U571 was to capture the submarine's enigma machine.
- One plot point in Tora! Tora! Tora! is that the US Military can decrypt the Japanese diplomatic codes. However, it is time-consuming, and very very secret. So secret, that at one point the President of the United States is removed from the list of people authorized to read the decoded messages because someone in his office improperly disposed of a decoded message. This of course only serves to add to the information delay that contributes to the Americans' failure to prepare for the impending attack.
- In From Russia with Love (originally a novel), James Bond must collect a Soviet defector from Turkey, who is bringing a cipher machine with her. He has to start a fire in the embassy to cover up the theft.
- In the Robert Harris novel Enigma, Bletchley Park has been locked out of "Shark", the German U-boat code. Part of the novel involves them getting back in, the other part making sure that the whole thing isn't blown to the Germans.
- In the later part of the story, the heroes use an Enigma machine to decrypt a message that was stolen- it is a report on the Germans finding the site of the Katyn Massacre, where 20,000 Polish soldiers were murdered in 1940 by the Soviets.
- In The Third World War, the US had cracked the Atrophos cipher being used by Cuba. In the early stages of the war, the Cubans send a long message stating that they cannot attack the US directly, but they might be able to do some small sabotage operations. While the Soviet cipher clerk is manually decrypting the message and wishing that the long-winded platitudes that begin it are done with, the Americans have broken the whole message. The Soviets interpret the message correctly (You cowards! You're wimping out like Italy in 1939), the Americans don't (They're going to attack us!) and launch air strikes on Cuba. It takes the rest of Latin America to stop a full-scale invasion.
- In The Thrawn Trilogy, eventually the New Republic did figure out that Thrawn was aware of all the plans they made in the Imperial Palace on Coruscant. They spent a lot of effort trying to figure out who the spy is. Only after a slicer cracks Delta Source's transmission encryption on his own time for fun do they figure out that it was a sophisticated listening system Hidden in Plain Sight.
- In Dan Brown's Digital Fortress, the NSA has a supercomputer capable cracking the digital encryption keys used in e-mails. The titular program is touted as being unbreakable, prompting the NSA to try and steal the program and secretly install a backdoor into the program, giving them unlimited access to enemy e-mail communications. However, things don't go as planned.
- Vetinari not only does this regularly in everyday life, but he expects others to do the same to him, and prepares accordingly. After all,
What would be the point of ciphering messages that very clever enemies couldn't break? You'd end up not knowing what they thought you thought they were thinking.
- In Monstrous Regiment, the Ankh-Morporkian representatives have the advantage of the City Watch Airborne Section, namely gnome Constable Buggy Swires and his buzzard, which lets them intercept messenger pigeons. Although not from the Borogravians, who disapprove of advanced communication technology, but from their own side's press.
- Vetinari not only does this regularly in everyday life, but he expects others to do the same to him, and prepares accordingly. After all,
- Most of Cryptonomicon (the 1940s bits, at least) is based around this. As with the real life section below, the Allies go to incredible amounts of effort to engineer plausible explanations for them having the information gained from intercepting enemy signals.
- Stephen Maturin of the Aubrey-Maturin series does this frequently. He even carefully edits the messages before passing them along to spread misinformation in enemy lines. While his friend Jack Aubrey found the operation very dishonorable, Stephen once mentioned that he has no qualms about violating an entire mail coach if it wins them the war.
- Jack Ryan:
- In The Sum of All Fears, a significant subplot involves whether or not NSA and State Department encoding methods have been cracked by the Soviets. In fact, they have, and at the end, when the US doesn't believe they've been cracked, it makes things in the climax significantly worse.
- Tom Clancy also likes looking into the specifics of certain cryptographic methods. Clear and Present Danger has a relatively long-winded passage on one-time pads (see below), and even The Hunt for Red October goes into some length about it.
- Something Egwene and the other rebel Aes Sedai try to do while Dreaming with regards to Elaida's mail.
- In Vernor Vinge's novella "True Names", Erythrina knows the True Name of one of The Mailman's associates, which gives her enough information to tap and decrypt communications between the two.
- The Connie Willis novel To Say Nothing of the Dog revolves around the attempt by two British timetravellers to prevent the possible exposure of the ULTRA program (see Real Life below) due to accidental alteration of the events of the bombing of Coventry by timetravellers.
- The W.E.B. Griffin Corps novels spend a lot of time discussing MAGIC (The codename for intercepted and decrypted Japanese communications), the importance of the data brought in by it, and the efforts necessary to ensure that (As one non-MAGIC communication obliquely put it) the rabbit stayed in the hat.
- The AI Gang: In Robot Trouble, Ramone Korbuscek infiltrates the island disguised as a security guard, and after a while starts reading security chief Brody's mail, among other things intercepting and destroying a letter advising Brody to investigate the guard Korbuscek is disguised as.
- The second act of Star Wars: Annihilation involves Republic SIS agent Theron Shan and Jedi Master Gnost-Dural infiltrating Ziost in order to steal an Imperial black cipher, the mechanism by which the Empire encrypts its sensitive communications. Stealing the cipher is the first step in the Republic's plans to take out the massively powerful Imperial battle cruiser Ascendant Spear, and - similar to stories regarding the real-life Enigma and Lorenz ciphers in WWII - this leads to a situation in which the Republic military opts not to act on foreknowledge of Imperial plans to bombard Republic planets because doing so would alert the Empire to the fact that their cipher has been compromised before the Ascendant Spear can be neutralized.
- Game of Thrones: Roose reads the exchange of messages between Cersei and Littlefinger. A wise move, considering that those two might be the most incredibly untrustworthy people to have ever existed.
- A sketch on Horrible Histories has Sir Francis Walsingham advertising his new postal service where your mail will be picked up, sorted, read by a spy...
- Charité at War: Professor Jung, a French medic who's conscripted to serve in a Berlin hospital in Nazi Germany, is not happy that his letters to and from home are controlled by censorship. It's not just enemy's mail, though — Otto is a German soldier, but he has to be careful with what he writes, too.
- ULTRA- namely the Allied decryption of the German Enigma and Lorenz ciphers for much of the war. Intensive efforts to provide "cover stories" were created- if you couldn't make it look like it had been found another way, you couldn't act on it.
- There is some suggestion that the British lost Crete to keep ULTRA secret. London knew things about the German invasion plans, and they told the general commanding the defence of Crete what they knew. But they didn't dare tell him how they knew. So he didn't place full reliance on the intelligence, didn't commit fully to defending the airfields, and lost.
- The bombing of Coventry during the Blitz is also believed to be a cover-up; ordering the city be evacuated would have revealed that the codes had been broken. This has been denied by people in a position to know - specifically, R.V. Jones, who maintained that while messages were intercepted and decrypted indicating that Coventry was a target, the decryption came too late to do anything about it.
- The Germans managed to crack the British merchant navy's codes in World War II. The Kriegsmarine used this information cautiously, leading Allied intelligence to think German sonar was far more advanced than it really was right up to the end of the war.
- The Americans also cracked the Japanese ciphers in World War II. In particular, the cracking of the Imperial Japanese Navy's JN-25b code by early 1942 allowed the US to get early warning that the IJN was planning a big operation around some place they only called "AF". On a hunch, the US instructed the US Navy base at Midway Island to fake a water supply problem and broadcast it uncoded over radio; within 24 hours the Japanese had parroted the information via JN-25b saying that AF was short on water, confirming that Midway was the target and allowing the US Navy to plan a trap around them.
- Where British, Germans and Americans cracked the enemy ciphers in World War II, the Italians choose an easier way: in September 1941 (when the US were still neutrals), Italian spies broke in the US embassy in Rome and stole the ciphers. From then on, the Italians were able to read the US diplomatic communications without any problem, something that, thanks to the American consul at Alexandria having access to the British war plans from December 1941 and reporting them to Washington, allowed the Axis forces in Africa to know what the British were doing. While the British caught on it fairly quickly, the Americans didn't believe it until June 1942, when the Germans spoke about it on the radio, allowing ULTRA to prove it and force the US to change codes (and recall that talkative consul).
- So the West couldn't do this, the Soviets used something called "one-time pads", where the coding method for each message was different. However, when one set got accidentally used twice, the West were able to figure out the messages and from 1946 break a good many of them. It was key to identifying a good number of Soviet moles, including the Rosenbergs and Julius Fuchs. Some people weren't prosecuted as VENONA (as it was called) was too valuable to be used in court- it was not declassified until 1995.
- The one-time pad is, as long as the key is not compromised or re-used, completely uncrackable. A communications device was invented by the Norwegians after WWII based on this principle, but since each message requires pre-delivery of a key as long as the message itself, they deemed it completely useless. The machine was later picked up by US Intelligence, who used it as the basis of the Hotline, since books with thousands of key codes could easily be exchanged by the embassies.
- The Americans used a low-tech solution in World War II by using Navajo code-talkers, nicknamed wind-talkers, not to be confused with the fictional account in the movie Windtalkers. They didn't just speak in the Navajo language (which the Japanese were completely clueless to figure out anyway), but also spoke in code in the language. It was basically double encryption. The British apparently made similar use of Welsh.
- Older Than They Think: in the previous war, Italian communications were handled in Sardinian Language (Sardu): regarded by many scholars to be the living language closest to Classical Latin, it is not an Italian dialect nor by any means related to Italian. In Italy, it is notoriously known for its difficulty to be actually understood by anyone not speaking it (that is, Italians and many Sardinians themselves, being and endangered language), unless spoken very slowly. And to be sure it couldn't be understood, the code-talkers weren't Italians speaking the literary version of Sardinian (that may have been understood), but actual Sardinians speaking their native dialects (which, even though they are all pretty much mutually intelligible, vary greatly the pronunciation of words).
- During the English Civil War, John Thurloe became the Spymaster for the Commonwealth, and later the Protectorate. He also became Postmaster-General, which probably made his job quite a bit easier (It is worth mentioning that he did such a good job with governance that he was not even imprisoned after the Restoration in exchange for assisting with central government.
- During the Irish War of Independence Michael Collins spy network was so sophisticated that top British Generals and Civil Servants mail arrived marked censored by the IRA.
- The Zimmermann Telegram was a diplomatic note that was sent by the German Empire to Mexico, looking at seeing whether Mexico would be interested in declaring war on the United States should the increasingly pro-Triple-Entente US enter World War I. The Germans promised financial and military aid to help Mexico reclaim the "lost territories" of Arizona, New Mexico, and Texas. This telegram was intercepted by the British as it was passing through the US (direct communication lines from Germany to the Western Hemisphere were cut by the British, so the only way the Germans could communicate with their embassies in the Americas was via Canada and the US) and turned over to the Americans (Britain had to find other pieces of evidence so as to avoid admitting it was reading the US's diplomatic mail), thus further enraging American public opinion and leading to the US's entry into WW1 on the side of the Entente. (Mexico, by the way, declined the offer.)
- For a non-wartime example, many sports teams use coded communications to coordinate their strategy on the field. Baseball has hand signals, American football uses code names for plays, etc. So what if the opposing team could get ahold of those codes? Well, they might win for a while, maybe even going as far as the league championship, but if their cheating is ever found out it would kick off a scandal and result in heavy penalties, as the Houston Astros found out the hard way.