All Topics  
Code (cryptography)

 

   Email Print
   Bookmark   Link






 

Code (cryptography)



 
 
In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a code is a method used to transform a message
Message

A message in its most general meaning is an Object of communication. It is something which provides information; it can also be this information itself....
 into an obscured form, preventing those who do not possess special information, or key
Key (cryptography)

In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
, required to apply the transform from understanding what is actually transmitted. The usual method is to use a codebook
Codebook

In cryptography, a codebook is a document used for implementing a code . A codebook contains a lookup table for coding and decoding; each word or phrase has one or more strings which replace it....
 with a list of common phrases or words matched with a codeword. Encoded messages are sometimes termed codetext, while the original message is usually referred to as plaintext
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
.

Terms like code and in code are often used to refer to any form of encryption
Encryption

In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key ....
.






Discussion
Ask a question about 'Code (cryptography)'
Start a new discussion about 'Code (cryptography)'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a code is a method used to transform a message
Message

A message in its most general meaning is an Object of communication. It is something which provides information; it can also be this information itself....
 into an obscured form, preventing those who do not possess special information, or key
Key (cryptography)

In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
, required to apply the transform from understanding what is actually transmitted. The usual method is to use a codebook
Codebook

In cryptography, a codebook is a document used for implementing a code . A codebook contains a lookup table for coding and decoding; each word or phrase has one or more strings which replace it....
 with a list of common phrases or words matched with a codeword. Encoded messages are sometimes termed codetext, while the original message is usually referred to as plaintext
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
.

Terms like code and in code are often used to refer to any form of encryption
Encryption

In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key ....
. However, there is an important distinction between codes and cipher
Cipher

In cryptography, a cipher is an algorithm for performing encryption and decryption — a series of well-defined steps that can be followed as a procedure....
s in technical work; it is, essentially, the scope of the transformation involved. Codes operate at the level of meaning; that is, words or phrases are converted into something else. Ciphers work at the level of individual letters, or small groups of letters, or even, in modern ciphers, with individual bits. While a code might transform "change" into "CVGDK" or "cocktail lounge", a cipher transforms elements below the semantic level, i.e., below the level of meaning. The "a" in "attack" might be converted to "Q", the first "t" to "f", the second "t" to "3", and so on. Ciphers are more convenient than codes in some situations, there being no need for a codebook, with its inherently limited number of valid messages, and the possibility of fast automatic operation on computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
s.

Codes were long believed to be more secure than ciphers, since (if the compiler of the codebook did a good job) there is no pattern of transformation which can be discovered, whereas ciphers use a consistent transformation, which can potentially be identified and reversed (except in the case of the one-time pad
One-time pad

In cryptography, the one-time pad is an encryption algorithm where the plaintext is combined with a random key or "pad" that is as long as the plaintext and used only once....
).

One- and two-part codes

Codes are defined by "codebooks" (physical or notional), which are dictionaries of codegroups listed with their corresponding plaintext. Codes originally had the codegroups assigned in 'plaintext order' for convenience of the code designed, or the encoder. For example, in a code using numeric code groups, a plaintext word starting with "a" would have a low-value group, while one starting with "z" would have a high-value group. The same codebook could be used to "encode" a plaintext message into a coded message or "codetext", and "decode" a codetext back into plaintext message.

However, such "one-part" codes had a certain predictability that made it easier for others to notice patterns and "crack
Cryptanalysis

Cryptanalysis is the study of methods for obtaining the meaning of encrypted information, without access to the secret information which is normally required to do so....
" or "break" the message, revealing the plaintext, or part of it. In order to make life more difficult for codebreakers, codemakers designed codes with no predictable relationship between the codegroups and the ordering of the matching plaintext. In practice, this meant that two codebooks were now required, one to find codegroups for encoding, the other to look up codegroups to find plaintext for decoding. Students of foreign languages work much the same way; for, say, a Frenchman studying English, there is need of both an English-French and a French-English dictionary. Such "two-part" codes required more effort to develop, and twice as much effort to distribute (and discard safely when replaced), but they were harder to break.

One-time code


A one-time code is a prearranged word, phrase or symbol that is intended to be used only once to convey a simple message, often the signal to execute or abort some plan or confirm that it has succeeded or failed. One time codes are often designed to be included in what would appear to be an innocent conversation. Done properly they are almost impossible to detect, though a trained analyst monitoring the communications of someone who has already aroused suspicion might be able to recognize a comment like "Aunt Bertha has gone into labor" as having an ominous meaning. Famous example of one time codes include:

  • "One if by land; two if by sea" in "Paul Revere's Ride
    Paul Revere's Ride (poem)

    "Paul Revere's Ride" is poem by an United States poet Henry Wadsworth Longfellow that commemorates the actions of American patriot Paul Revere on April 18, 1775....
    " made famous in the poem by Henry Wadsworth Longfellow
    Henry Wadsworth Longfellow

    Henry Wadsworth Longfellow was an United States educator and poet whose works include "Paul Revere's Ride ", The Song of Hiawatha, and "Evangeline"....
  • "Climb Mount Niitaka" - the signal to Japanese planes to begin the attack on Pearl Harbor
    Attack on Pearl Harbor

    The attack on Pearl Harbor was a surprise military strike conducted by the Empire of Japan Imperial Japanese Navy against the United States' naval base at Pearl Harbor, Hawaii, on the morning of Sunday, December 7, 1941, later resulting in the United States becoming militarily involved in World War II....
  • During World War II
    World War II

    World War II, or the Second World War , was a global military conflict which involved a Participants in World War II, including all of the great powers, organised into two opposing military alliances: the Allies of World War II and the Axis powers....
     the British Broadcasting Corporation's overseas service frequently included "personal messages" as part of its regular broadcast schedule. The seemingly nonsensical stream of messages read out by announcers were actually one time codes intended for SOE
    Special Operations Executive

    The Special Operations Executive , was a United Kingdom World War II organisation. It was initiated by Winston Churchill and Hugh Dalton in July 1940, to conduct warfare by means other than direct military engagement....
     agents operating behind enemy lines. An example might be "The princess wears red shoes" or "Mimi's cat is asleep under the table". Each code message was read out twice. By such means, the French Resistance
    French Resistance

    File:Croix de Lorraine2.svgThe French Resistance is the collective name used for the French resistance movements which fought against the Nazi Germany German occupation of France in World War II and the collaborationist Vichy Regime during World War II....
     were instructed to start sabotaging rail and other transport links the night before D-day
    D-Day

    D-Day is a term often used in military parlance to denote the day on which a combat attack or operation is to be initiated. "D-Day" often represents a variable , designating the day upon which some significant event will occur or has occurred; see Military designation of days and hours for similar terms....
    .
  • "Over all of Spain, the sky is clear" was a signal (broadcast on radio) to start the nationalist military revolt in Spain
    Spanish Civil War

    The Spanish Civil War was a major conflict in Spain that started after an attempted coup d'?tat by a group of Spanish Army generals, supported by the conservative Spanish Confederation of the Autonomous Right , Carlist groups and the fascistic Falange, against the government of the Second Spanish Republic, then under the leadership of pr...
     on July 17, 1936.


Sometimes messages are not prearranged and rely on shared knowledge hopefully known only to the recipients. An example is the telegram sent to U.S. President Harry Truman, then in Potsdam
Potsdam

Potsdam is the capital city of the Germany States of Germany of Brandenburg and is part of the Metropolitan area of Berlin/Brandenburg. It is situated on the River Havel, some 25 kilometres southwest of the center of Berlin....
 to meet with Stalin, informing Truman of the first successful test
Trinity test

Trinity was the first Nuclear testing of technology for a nuclear weapon. It was conducted by the United States on July 16, 1945, at a location 35 miles southeast of Socorro, New Mexico, New Mexico, on what is now White Sands Missile Range, headquartered near Alamogordo, New Mexico....
 of an atomic bomb.
"Operated on this morning. Diagnosis not yet complete but results seem satisfactory and already exceed expectations. Local press release necessary as interest extends great distance. Dr. Groves
Leslie Groves

Lieutenant General Leslie Richard Groves was a United States Army Engineer Officer who oversaw the construction of the Pentagon and was the primary military leader in charge of the Manhattan Project to develop the atomic bomb during World War II....
 pleased. He returns tomorrow. I will keep you posted."


See also one-time pad
One-time pad

In cryptography, the one-time pad is an encryption algorithm where the plaintext is combined with a random key or "pad" that is as long as the plaintext and used only once....
, an unrelated cypher algorithm

Idiot code


An idiot code is a code that is created by the parties using it. This type of communication is akin to the hand signals used by armies in the field.

Example: Any sentence where 'day' and 'night' are used means 'attack'. The location mentioned in the following sentence specifies the location to be attacked.
  • Plaintext: Attack Gotham.
  • Codetext: We walked day and night through the streets but couldn't find it! Tomorrow we'll head into Gotham.


An early use of the term appears to be by George Perrault, a character in the science fiction book Friday by Robert Heinlein:

The simplest sort [of code] and thereby impossible to break. The first ad told the person or persons concerned to carry out number seven or expect number seven or it said something about something designated as seven. This one says the same with respect to code item number ten. But the meaning of the numbers cannot be deduced through statistical analysis because the code can be changed long before a useful statistical universe can be reached. It's an idiot code... and an idiot code can never be broken if the user has the good sense not to go too often to the well.


Richard Miniter, author of Losing Bin Laden: How Bill Clinton's Failures Unleashed Global Terror, was quoted in an interview by UPI Technology News:
Another way terrorists use the Internet to communicate is through conventional message boards. They simply go to common public places online, chat rooms and the like, and post messages using what intelligence operatives call an "idiot code", said Miniter.


Terrorism expert Magnus Ranstorp said that the men who carried out the September 11, 2001, attacks on the United States used basic e-mail and what he calls "idiot code" to discuss their plans.

Cryptanalysis of codes

While solving a monoalphabetic substitution cipher is easy, solving even a simple code is difficult. Decrypting a coded message is a little like trying to translate a document written in a foreign language, with the task basically amounting to building up a "dictionary" of the codegroups and the plaintext words they represent.

One fingerhold on a simple code is the fact that some words are more common than others, such as "the" or "a" in English. In telegraphic messages, the codegroup for "STOP" (i.e., end of sentence or paragraph) is usually very common. This helps define the structure of the message in terms of sentences, if not their meaning, and this is cryptanalytically useful.

Further progress can be made against a code by collecting many codetexts encrypted with the same code and then using information from other sources
  • spies,
  • newspapers,
  • diplomatic cocktail party chat,
  • the location from where a message was sent,
  • where it was being sent to (i.e., traffic analysis
    Traffic analysis

    Traffic analysis is the process of intercepting and examining messages in order to deduce information from patterns in communication. It can be performed even when the messages are encrypted and cannot be cryptanalysis....
    )
  • the time the message was sent,
  • events occurring before and after the message was sent
  • the normal habits of the people sending the coded messages
  • etc.


For example, a particular codegroup found almost exclusively in messages from a particular army and nowhere else might very well indicate the commander of that army. A codegroup that appears in messages preceding an attack on a particular location may very well stand for that location.

Of course, crib
Crib (cryptanalysis)

Crib, in cryptanalysis, is a sample of known plaintext or Bombe#cribs. The term originated at Bletchley Park, the British World War II decryption operation....
s can be an immediate giveaway to the definitions of codegroups. As codegroups are determined, they can gradually build up a critical mass, with more and more codegroups revealed from context and educated guesswork. One-part codes are more vulnerable to such educated guesswork than two-part codes, since if the codenumber "26839" of a one-part code is determined to stand for "bulldozer", then the lower codenumber "17598" will likely stand for a plaintext word that starts with "a" or "b". At least, for simple one part codes.

Various tricks can be used to "plant" or "sow" information into a coded message, for example by executing a raid at a particular time and location against an enemy, and then examining code messages sent after the raid. Coding errors are a particularly useful fingerhold into a code; people reliably make errors, sometimes disastrous ones. Of course, planting data and exploiting errors works against ciphers as well.

  • The most obvious and, in principle at least, simplest way of cracking a code is to steal the codebook through bribery, burglary, or raiding parties — procedures sometimes glorified by the phrase "practical cryptography" — and this is a weakness for both codes and ciphers, though codebooks are generally larger and used longer than cipher key
    Key (cryptography)

    In cryptography, a key is a piece of information that determines the functional output of a cryptographic algorithm or cipher. Without a key, the algorithm would have no result....
    s. While a good code may be harder to break than a cipher, the need to write and distribute codebooks is seriously troublesome.


Constructing a new code is like building a new language and writing a dictionary for it; it was an especially big job before computers. If a code is compromised, the entire task must be done all over again, and that means a lot of work for both cryptographers and the code users. In practice, when codes were in widespread use, they were usually changed on a periodic basis to frustrate codebreakers, and to limit the useful life of stolen or copied codebooks.

Once codes have been created, codebook distribution is logistically clumsy, and increases chances the code will be compromised. There is a saying that "Three people can keep a secret if two of them are dead," and though it may be something of an exaggeration, a secret becomes harder to keep if it is shared among several people. Codes can be thought reasonably secure if they are only used by a few careful people, but if whole armies use the same codebook, security becomes much more difficult.

In contrast, the security of ciphers is generally dependent on protecting the cipher keys. Cipher keys can be stolen and people can betray them, but they are much easier to change and distribute.

Superencipherment

In more recent practice, it became typical to encipher a message after first encoding it, so as to provide greater security by increasing the degree of difficulty for cryptanalysts. With a numerical code, this was commonly done with an "additive" - simply a long key number which was digit-by-digit added to the code groups, modulo 10. Unlike the codebooks, additives would be changed frequently. The famous Japanese Navy code, JN-25
JN-25

During World War II, the Imperial Japanese Navy used many codes and ciphers, some more effective than others. Perhaps the best known was JN-25, whose partial break by the Americans made possible the victorious ambush at Battle of Midway....
, was of this design, as were several of the (confusingly named) Royal Navy Cyphers used after WWI and into WWII.

One might wonder why a code would be used if it had to be enciphered to provide security. As well as providing security, a well designed code can also compress
Data compression

In computer science and information theory, data compression or source coding is the process of encoding information using fewer bits than an code representation would use through use of specific encoding schemes....
 the message, and provide some degree of automatic error correction. For ciphers, the same degree of error correction has generally required use of computers.

See also

  • Code
    Code

    In communications, a code is a Operator for converting a piece of information into another form or representation , not necessarily of the same type....
    , its more general communication
    Communication

    Communication is commonly defined as "the imparting or interchange of thoughts, opinions, or information by speech, writing, or signs...",, 1: an act or instance of transmitting and 3 a: "a process by which information is exchanged between individuals through a common system of symbols, signs, or beha...
    s meaning
  • List of coding terms
Category:Encodings
  • Trench code
    Trench code

    In cryptography, trench codes were code s used for secrecy by field armies in World War I. A reasonably-designed code is generally more difficult to crack than a classical cipher, but of course suffers from the difficulty of preparing, distributing, and protecting codebook....
  • JN-25
    JN-25

    During World War II, the Imperial Japanese Navy used many codes and ciphers, some more effective than others. Perhaps the best known was JN-25, whose partial break by the Americans made possible the victorious ambush at Battle of Midway....
  • Zimmermann telegram
    Zimmermann Telegram

    The Zimmermann Telegram was a code telegram dispatched by the Foreign Secretary of the German Empire, Arthur Zimmermann, on January 16, 1917, to the Germany Ambassador in Washington, D....
  • Code talkers