3.4 Transposition Cipher

3.4.1 Encrypting Using Transposition

One way to scramble the letters of a message is to separate the message into two groups of characters, where the first group is composed of the even-numbered characters and the second group is composed of the odd-numbered characters. If we create one string out of the even-numbered characters and another out of the odd-numbered characters, we can concatenate the two new strings together to form the ciphertext string. Because this results in a string with the characters shuffled to new positions, we call this a transposition cipher, also sometimes called the rail fence cipher. FIGURE 3.3 illustrates the idea behind this encryption algorithm.

Get Python Programming in Context, 3rd 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.