In cryptography, a cipher is an algorithm used to perform encryption and/or decryption.
Some people may use the alternative spelling cypher, but the meaning is still the same.
In common usage, the terms code and cipher may be considered synonymous.
In the field of cryptography, however, the two are distinct.
Alternatively, the code can be a completely meaningless combination of characters.
I hear the weather in Paris is nice this time of year.
and Ive always been more partial to Dublin personally.
could be a pair of challenge-response code phrases.
Such a code phrase system benefits from plausible deniability.
Some codes may not use full words at all.
For example, UBDIBF could be a code word used to indicate mission complete, all objectives fulfilled.
Anyone seeing or hearing such a code would be able to assume that some secret message is being passed.
Without knowing the code, however, they would be unable to determine the meaning.
Such codes benefit from being shorter and easier to transmit.
Both methods also launch the risk that the operative forgets the correct code to use.
In modern cryptography, there are two distinct ways of defining algorithms.
The first is by the key in of key.
A symmetric cipher, uses the same key to encrypt and decrypt data.
A symmetric key is generally referred to as the secret key.
An asymmetric cipher uses two different keys, one to encrypt data and one to decrypt.
Ciphers can also be classified as a stream or block cipher.
A stream cipher encrypts a continuous stream of symbols.
Classical vs modern ciphers
Classical ciphers were relatively simple.
These tended to involve transposition or substitution.
A substitution cipher such as the Caesar cipher or ROT13 substitutes one letter in the alphabet for another.
In ROT13, each letter is substituted with the letter 13 characters after it in the alphabet.
A transposition cipher acts similarly but doesnt have the same shift for each character.
Such techniques, even when the transposition alphabet is changed after each letter are relatively easy to crack.
Once an enemy understands the cipher, they can just try all the keys and break the system.
Modern ciphers rely on Kerckhoffs principle.
As such, modern ciphers are public and well-researched without compromising their security.
Conclusion
A cipher is another name for an encryption algorithm.
Some people may use the term interchangeable with code (as in enciphered = encoded).
This is not strictly correct though.
A code relies on the meanings of the code remaining secret.
A code can also be arbitrarily decided.
A cipher is a repeatable algorithm for enciphering arbitrary data.
A ciphers security relies on the key remaining secret.
The term cipher comes from the Arabic word for zero (sifr).
Over time, in England, this term evolved into the word cipher.