[Cryptography] What is the difference between a code and a cipher?

Jerry Leichter leichter at lrw.com
Thu Sep 4 14:42:23 EDT 2014


On Sep 3, 2014, at 11:16 PM, Peter Fairbrother <zenadsl6186 at zen.co.uk> wrote:
> Old chestnut - is it being intended to be hard to decrypt? Having a variable key? Something else?
> 
> I don't know whether there is a definitive answer, but opinions are sought.
Traditionally, codes operated at the word level, while ciphers operated at the character level.

In the days of human encryption and decryption, codes relied on "dictionaries" that took a word to some specific sequence of symbols (in better codes, to one of a set of symbols to avoid leaking which sequences corresponded to common words), and symbols back to the word they came from.  The boundaries between words were as used in traditional grammar, and the boundaries between symbols were (necessarily) maintained.  Generally, punctuation was spelled out, so the input was really just words separated by spaces.  The encoding would usually just be groups of letters separated by spaces, too.  (Since the most common use of codes was in telegrams, the constraints of telegraphy would apply to the encoded form - and in practice would normally apply to the clear text as well.) 

Ciphers, conversely, transformed one character at a time.

Encoding "sand" and "sandy" would produce two completely unrelated "code words".

Enciphering "sand" and "sandy" would produce some four-character sequence for "sand", and that sequence followed by some fifth character for "sandy".

The boundaries here were always somewhat arbitrary.  There were ciphers that operated on pairs of successive letters, for example.  (In principle you could have made the "block size" as long as you liked, but for paper-and-pencil operation more than two letters - which would likely be used to specify a row and column in an enciphering table - was probably the practical limit.)

Codes in the traditional sense are no longer used.  (Actually, if I had to bet, they probably *are* still used in some specialized applications.)  The distinction is likely of historical interest only at this point.

                                                        -- Jerry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4813 bytes
Desc: not available
URL: <http://www.metzdowd.com/pipermail/cryptography/attachments/20140904/f5b58dba/attachment.bin>


More information about the cryptography mailing list