3.5 Substitution Cipher

The transposition cipher provides us with a simple example, but it is not a very secure form of encryption. An attacker who is trying to read your secret messages and knows you are using a transposition cipher will find it easy to use the same algorithm to decrypt your message.

Another kind of cipher, called the substitution cipher, substitutes one letter for another throughout a message. For example, you might decide that 'a' => 't'. In this case, the letter 't' would be inserted into the ciphertext in each place where an 'a' appears in the plaintext. Substitution ciphers have been used since the time of Caesar, and they remain popular today—just look at the “Cryptoquip” in the daily newspaper.

The substitution cipher ...

Get Python Programming in Context, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.