hkucuk

Transposition Encryption: The Art of Providing Privacy by Changing Letter Positions

July 14, 2022 • ☕️ 3 min read • 🏷 computer, software, encryption

Translated by author into: English


Cryptography is a special field used to protect confidentiality in communication. This discipline includes methods designed to ensure that information remains secure, often aimed at protecting sensitive data from unauthorized access. Cryptography involves many different encryption methods, and these methods are widely used to increase information security and protect privacy. These encryption techniques increase the security of communication and ensure confidentiality by ensuring that messages can only be understood by authorized persons.

What is Transposition Encryption?

Transposition encryption is a very interesting cryptography method that encrypts text by relocating the letter positions in the text following a certain pattern. The basic principle is to create an encrypted text by changing the order of letters in the text. These changes make the text different from the original and make communication more secure.

This type of encryption has historically been used in military and diplomatic communications. Changing letter positions with a specific key to make it difficult for enemies to understand messages increases the security of communications. However, this method has now been superseded by more complex and powerful encryption techniques.

What are the Purposes of Transposition?

  1. Protection of Confidentiality: Transposition encryption is intended to ensure the confidentiality of communication. When messages are encrypted, only people with the correct key will be able to decrypt the message.
  2. Information Protection: Transposition encryption helps protect sensitive information from unauthorized access. It is used especially in military and diplomatic communication to prevent enemies from deciphering messages easily.

Types of Transposition Encryption

Transposition encryption has a wide category that includes different types. Here are some basic types of Transposition encryption:

  1. ROUTE Cipher (ROT): This type encrypts text following a specific path in a plane. The text is encrypted and decrypted by circulating it in a certain direction. There are varieties in the form of clockwise or counterclockwise rotation.
  2. Rail Fence Cipher: In this encryption type, the text is thought of as a fence and the letters are placed in sequence on the fence panels. The ciphertext is obtained sequentially across the fence panels.
  3. Columnar Transposition Cipher: In this method, text is placed in a matrix and columns of text are replaced with a specific order or key. Decryption is done by placing the columns in the correct order.

In Which Fields Is Transposition Encryption Used?

Transposition encryption has historically been used in military and diplomatic communications. However, it is generally not secure by modern cryptography standards because it can be cracked with simple keys. For this reason, stronger and more complex encryption methods are preferred today.

Transposition encryption is an ancient method of cryptography used to provide confidentiality in communication. It works by changing letter positions and has many different types. However, stronger encryption methods have been developed to meet modern cryptography needs.

Implementation of Transposition Encryption (Columnar Transposition) in GoLang:

package main

import (
	"fmt"
	"math"
	"strings"
)

func encryptMessage(key int, message string) string {
	cipherText := make([]string, key)

	for col := 0; col < key; col++ {
		pointer := col
		for pointer < len(message) {
			cipherText[col] += string(message[pointer])
			pointer += key
		}
	}

	return strings.Join(cipherText, "")
}

func decryptMessage(key int, message string) string {
	numCols := int(math.Ceil(float64(len(message)) / float64(key)))
	numRows := key
	numShadedBoxes := (numCols * numRows) - len(message)
	plainText := make([]string, numCols)

	col, row := 0, 0

	for _, symbol := range message {
		plainText[col] += string(symbol)
		col++

		if (col == numCols) || (col == numCols-1 && row >= numRows-numShadedBoxes) {
			col = 0
			row++
		}
	}

	return strings.Join(plainText, "")
}

func main() {

	message := "TopSecret"
	key := 3

	encryptedText := encryptMessage(key, message)
	fmt.Printf("Encrypted Message: %s\n", encryptedText)

	decryptedText := decryptMessage(key, encryptedText)
	fmt.Printf("Decrypted Message: %s\n", decryptedText)
}

When the program is run, the output will be as follows.

Encrypted Message: TSroeepct
Decrypted Message: TopSecret

The running version of the program can be accessed from here.


Resources