Learn R Programming

cryptography (version 1.0.0)

columnar_transposition: Columnar Transposition Cipher

Description

This can be used to encrypt or decrypt a Columnar Transposition cipher. This method is a development of the Scytale cipher that rearranges the encryption matrix used in the Scytale method by the alphabetical ordering of the encryption key.

Usage

columnar_transposition(message, key, encrypt = TRUE)

Value

A character vector of either plaintext that has been encrypted or ciphertext that has been decrypted using the columnar transposition cryptographic method.

Arguments

message

A character vector

key

A character vector composed only of a-zA-Z letters used as the encryption key

encrypt

(Default: TRUE) TRUE will encrypt the message, while FALSE will decrypt the message.

Examples

Run this code
columnar_transposition("Hidden message", "hack", encrypt = TRUE)
columnar_transposition("insed sHeegdma", "hack", encrypt = FALSE)

Run the code above in your browser using DataLab