Misplaced Pages

Code: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 09:27, 23 January 2003 view sourceRochus (talk | contribs)25 editsm Added links to examples← Previous edit Revision as of 19:47, 14 February 2003 view source 163.151.0.253 (talk) corrected confusion between code and cypherNext edit →
Line 5: Line 5:
For example, a cable code replaces words (eg, ship, invoice, ...) into shorter words, allowing the same information to be sent with fewer characters, more quickly, and most important, less expensively. For example, a cable code replaces words (eg, ship, invoice, ...) into shorter words, allowing the same information to be sent with fewer characters, more quickly, and most important, less expensively.
Another example is the use of ], where the configuration of flags Another example is the use of ], where the configuration of flags
held by a signaller or the arms of a semaphore tower encodes the message. held by a signaller or the arms of a semaphore tower encodes parts of the message, typically individual letters and numbers.
Another person standing a great distance away can interpret the flags and reproduce the words sent. Another person standing a great distance away can interpret the flags and reproduce the words sent.


The term ''code'' is very often confused with the term ''cipher''. The term ''code'' is very often confused with the term ''cipher''.
These can be destinguished best by the purpose to use the code. These can be destinguished best by the scope of the transformation.
A code is just a rule to represent information in another way - this A code is just a rule to represent meaningful information in another way - this
doesn't necessarily imply secrecy. When the information should not be doesn't necessarily imply secrecy. When the information should not be
known to somebody else but the intended recipient, there has to known to somebody else but the intended recipient, there has to
be some secret knowledge not known to anybody else to decode it. be some secret knowledge not known to anybody else to decode it.
A code which requires such secret knowledge (or ''is'' this A code which requires such secret knowledge (or ''is'' this
secret knowledge) is a cryptographic code and the secret information is a codebook. A ] by contrast, does not work at the level of meaningful information. While a code might transform "attack" into FRGPL or "fruit pie", a cipher transforms elements below the semantic level, ie, 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. Cyphers are more convienient than codes in some situations, there being no need for a codebook. Codes on the other hand, were believed to be more secure than cyphers, there being (if one's codebook constructor did a good job) no pattern of transformation to discover. Witht the advent of automatic processors (ie, in recent times the electronic computer), cyphers have come to dominate cryptography.
secret knowledge) is a ].
Thus a cipher is a special case of a code,
since it is just means to represent the information in
another way - with the intention, to keep it secret.
However, it is more appropriate to call it cipher then.
Historically there were codes for secrecy,
which operated on word or phrase-level.
These were called ''nomenclator''s.


Codes can be used for brevity. Codes can be used for brevity.
In the days when telegraph messages were the state of the art, elaborate commercial codes that encoded complete phrases When telegraph messages were the state of the art, elaborate commercial codes that encoded complete phrases
into single words (typically five-letter groups) were developed, so that telegraphers became conversant with into single words (typically five-letter groups) were developed, so that telegraphers became conversant with
such "words" as BYOXO ("Are you trying to crawl out of it?"), LIOUY ("Why do you not answer my question?"), such "words" as BYOXO ("Are you trying to crawl out of it?"), LIOUY ("Why do you not answer my question?"),
or AYYLU ("Not clearly coded, repeat more clearly."). or AYYLU ("Not clearly coded, repeat more clearly."). Codebook publishers proliferated.
The purpose of these codes was to save on cable costs. The purpose of these codes was to save on cable costs.
Nowadays there are codes for ], Nowadays there are "codes" for ],
e.g. ], which uses short codes for often used e.g. ], which uses short codes for frequent
symbols and long codes for seldom used symbols - the same principle symbols and longer codes for seldom used symbols - the same principle
is used in the ]. is used in the ].


Probably the most widely known communications code in use today is ]. Probably the most widely known data communications code (aka character representation) in use today is ].
It is employed by nearly all personal ]s, ]s, In one or another (somewhat compatible) version, it is used by nearly all personal ]s, ]s,
]s, and other communication equipment. ]s, and other communication equipment.
It represents 128 ]s with seven-bit binary numbers--that is, as a string of seven 1s and 0s. Its original version represents 128 ]s with seven-bit binary numbers--that is, as a string of seven 1s and 0s.
In ASCII a lowercase "a" is always 1100001, an uppercase "A" always 1000001, and so on. In ASCII a lowercase "a" is always 1100001, an uppercase "A" always 1000001, and so on.
Extensions to ASCII have included 8-bit characters (for letters of European languages and such things Extensions to ASCII have included 8-bit characters (for letters of European languages and such things
Line 45: Line 38:


Codes may also be used to represent data in a way more resistant Codes may also be used to represent data in a way more resistant
to errors in transmission or storage. Such a code is to errors in transmission or storage. Such a "code" is
called ]. called ], and works by including carefully crafted redundancy with the stored (or transmitted) data.


Another use of codes is ], where a code or ] is used to disguise a message, Another use of codes is ], where a code or ] is used to disguise a message,
Line 52: Line 45:
One simple method is to use a "codebook" with a list of common phrases replaced by phrases with One simple method is to use a "codebook" with a list of common phrases replaced by phrases with
completely different meanings, so that people without the codebook who may intercept the message completely different meanings, so that people without the codebook who may intercept the message
hear a conversation that is entirely unrelated to the real intended message. A cable code, of which only the sender and receipient have copies, would be one such. hear a conversation that is entirely unrelated to the real intended message, or alternatively, complete gibberish. A cable code would be one such.


] and abbreviations can be considered codes, and in a sense all ] ] and abbreviations can be considered codes, and in a sense all ]
Line 60: Line 53:
For example, the number "86" was once used as a code word in restaurants meaning "We're out of For example, the number "86" was once used as a code word in restaurants meaning "We're out of
the requested item". the requested item".
It is now commonly used to mean the removal or destruction of something. '30' was widely used in journalism to mean end of story, and it is sometimes used in other contexts to signify 'the end'. It is now commonly used to mean the removal or destruction of something. '30' was widely used in journalism to mean end_of_story, and it is sometimes used in other contexts to signify 'the end'.


---- ----
Line 76: Line 69:
A '''code''' is also a rule or a set of rules, such as code of honor, code of laws, or dress code. A '''code''' is also a rule or a set of rules, such as code of honor, code of laws, or dress code.


This word has acquired a large number of subtly and grossly incompatible meanings, particularly in cryptographic contexts. This word has acquired a large number of subtly, and grossly, incompatible meanings, particularly in cryptographic contexts.
Use it with care. Use it with care.

Revision as of 19:47, 14 February 2003

In communications, a code is a rule for converting a piece of information (for example, a letter, word, or phrase) into another object or action, not necessarily of the same sort. One reason for this is to enable communication in places where ordinary spoken or written language is difficult or impossible. For example, a cable code replaces words (eg, ship, invoice, ...) into shorter words, allowing the same information to be sent with fewer characters, more quickly, and most important, less expensively. Another example is the use of semaphore flags, where the configuration of flags held by a signaller or the arms of a semaphore tower encodes parts of the message, typically individual letters and numbers. Another person standing a great distance away can interpret the flags and reproduce the words sent.

The term code is very often confused with the term cipher. These can be destinguished best by the scope of the transformation. A code is just a rule to represent meaningful information in another way - this doesn't necessarily imply secrecy. When the information should not be known to somebody else but the intended recipient, there has to be some secret knowledge not known to anybody else to decode it. A code which requires such secret knowledge (or is this secret knowledge) is a cryptographic code and the secret information is a codebook. A cipher by contrast, does not work at the level of meaningful information. While a code might transform "attack" into FRGPL or "fruit pie", a cipher transforms elements below the semantic level, ie, 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. Cyphers are more convienient than codes in some situations, there being no need for a codebook. Codes on the other hand, were believed to be more secure than cyphers, there being (if one's codebook constructor did a good job) no pattern of transformation to discover. Witht the advent of automatic processors (ie, in recent times the electronic computer), cyphers have come to dominate cryptography.

Codes can be used for brevity. When telegraph messages were the state of the art, elaborate commercial codes that encoded complete phrases into single words (typically five-letter groups) were developed, so that telegraphers became conversant with such "words" as BYOXO ("Are you trying to crawl out of it?"), LIOUY ("Why do you not answer my question?"), or AYYLU ("Not clearly coded, repeat more clearly."). Codebook publishers proliferated. The purpose of these codes was to save on cable costs. Nowadays there are "codes" for data compression, e.g. Huffman coding, which uses short codes for frequent symbols and longer codes for seldom used symbols - the same principle is used in the Morse code.

Probably the most widely known data communications code (aka character representation) in use today is ASCII. In one or another (somewhat compatible) version, it is used by nearly all personal computers, terminals, printers, and other communication equipment. Its original version represents 128 characters with seven-bit binary numbers--that is, as a string of seven 1s and 0s. In ASCII a lowercase "a" is always 1100001, an uppercase "A" always 1000001, and so on. Extensions to ASCII have included 8-bit characters (for letters of European languages and such things as card suit symbols), and in fullest flowering have included glyphs from essentially all of the world's writing systems (see Unicode).

Codes may also be used to represent data in a way more resistant to errors in transmission or storage. Such a "code" is called Error-correcting code, and works by including carefully crafted redundancy with the stored (or transmitted) data.

Another use of codes is cryptography, where a code or cipher is used to disguise a message, preventing those not in on the secret from understanding a transmission. One simple method is to use a "codebook" with a list of common phrases replaced by phrases with completely different meanings, so that people without the codebook who may intercept the message hear a conversation that is entirely unrelated to the real intended message, or alternatively, complete gibberish. A cable code would be one such.

Acronyms and abbreviations can be considered codes, and in a sense all languages and writing systems are codes for human thought. Occasionally a code word achieves an independent existence (and meaning) while the original equivalent phrase is forgotten or at least no longer has the precise meaning attributed to the code word. For example, the number "86" was once used as a code word in restaurants meaning "We're out of the requested item". It is now commonly used to mean the removal or destruction of something. '30' was widely used in journalism to mean end_of_story, and it is sometimes used in other contexts to signify 'the end'.


In computer programming, the word code refers to instructions to a computer in a programming language. In this usage, the noun "code" typically stands for source code, and the verb "to code" means to write source code, to program. This usage may have originated when the first symbolic languages were developed and were punched onto cards as "codes".

Engineers often use the word "code" to mean a single program. They might say "I wrote a code" or "I have two codes". No software engineer or computer scientist would say that. They would say "I wrote some code" or "I have two programs".


A code is also a rule or a set of rules, such as code of honor, code of laws, or dress code.

This word has acquired a large number of subtly, and grossly, incompatible meanings, particularly in cryptographic contexts. Use it with care.