In general, there are three types of cryptography algorithms:
- Symmetric Key Cryptography: It involves a single key that is used for both encryption and decryption.
- Asymmetric Key Cryptography: It uses a pair of two different keys, one used for encryption and the other for decryption.
- Hash Function: A hash function is a one-way mathematical function that is used to produce a unique hash value from original data. The hash function is not reversible which means that the original data cannot be reconstituted from the hash value even with the knowledge of the hash function. The hash value is usually appended to the original message as the unique identifier of the message like a fingerprint.
In Figure 12-2, we present a very simple encryption algorithm known as the Caesar cipher. This method is named after Julius Caesar, who used it to encrypt his private correspondence. Each alphabet is shifted right or left by a fixed number of positions. The number of positions and the direction of shift must be known to both the sender and receiver in order to encrypt and decrypt the message.
Caesar cipher with a left shift of three positions looks like this:
- Plaintext: ABCD EFGH IJKL MNOP QRST UVWX YZ
- Ciphertext: XYZA BCDE FGHI JKLM NOPQ RSTU VW
Figure 12-2 Encryption Process
Please keep in mind that today’s encryption algorithms are way more complex than the Caesar cipher and involve complicated mathematical computations that can be performed only by computers. However, the basic principle of encryption is still the same.