According to Webster’s, cryptography is:
Definition of cryptography
1 : secret writing
2 : the enciphering and deciphering of messages in secret code or cipher; also : the computerized encoding and decoding of information
Writing itself was probably the first form of cryptography as only a few people could read or write. Writing probably came from number tallies and numbers; then those tallies formed into pictures and alphabets later in time. Early writing became the hidden form of communication among the literate, mainly nobles and the clergy.
Later as more people learned to read and write, those who needed secret communications needed to create novel forms of writing such as codes and ciphers. A code to a substitution of a word or phrase by another and a cipher is translating the writing with a procedure or function.
Codes are used to obscure information and as long as the substitution is obscure enough they can’t be broken. A good code is random or only has a very few people clued into the meanings. A famous example of a code is the Navajo and Hopi code talkers in World War 2. They used very obscure forms of Navajo and Hopi slang to communicate. This code was never broken by the Japanese.
Ciphers are methods used to translate a message into unreadable forms and back again to a readable form. An early example of a cipher is a transposition cipher. This type of cipher transposes letters according to a secret method. Another method was to substitute each letter with another one. The Caesar cipher is a simple version of this. Each letter of the alphabet is substituted by selecting a letter numbers to the right or left, decided upon the sender and receiver.
One way a transposition cipher was done was to wrap a flat cord around a staff of a certain diameter, then write the message. The messenger could travel with an unreadable cord. Upon arrival, the message would be recreated by wrapping the cord around another staff of the same diameter.
These two methods constitute the two major operations most ciphers are based on. Over time more complicated substitutions and transpositions were added and alphabets were modified to hide the characteristics of the underlying language. Nowdays alphabets are based upon 8 bit bytes and the substitution and transposition operations are now complicated and determined on random blocks and the text to be encrypted.