Learn R Programming

cryptography (version 1.0.0)

scytale: Scytale cipher

Description

This can be used to encrypt and decrypt a Scytale cipher. A Scytale cipher is an ancient form of cryptography that wraps a message (typically written on a long thing piece of paper) around a device to create a matrix with a fixed number of columns that transposes the text.

Usage

scytale(message, col, encrypt = TRUE)

Value

A character vector of either plaintext that has been encrypted or ciphertext that has been decrypted.

Arguments

message

A character vector

col

A positive integer, this determines the number of columns in the encryption matrix. 1 column will have no effect

encrypt

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

Examples

Run this code
scytale("very super secret message!", col = 4, encrypt = TRUE)
scytale("v eetseesrc s!ru rmaypseeg", col = 4, encrypt = FALSE)

Run the code above in your browser using DataLab