playfair: Create a playfair-style cipher from a character string

View source: R/playfair.R

playfairR Documentation

Create a playfair-style cipher from a character string

Description

Create a playfair-style cipher from a character string

Usage

playfair(x)

Arguments

x

character string to encode

Details

Creates a cipher based on the original playfair cipher. Unlike the original playfair cipher this method produces a 6x6 grid of upper and lowercase letters. Additionally, the behaviour when a keypair appears on the same row or column of the decoder matrix is different. In this version keypairs which appear on the same row or column are merely swapped rather than transposed as in the original cipher. Messages to be encoded are converted to uppercase and all non-alphabet characters are stripped out.

Value

list with three elements: (1) encoded message (2) decoder matrix (3) decoder lookup table

Examples

x <- "This is a test"
playfair(x)


johngodlee/JLGMisc documentation built on June 29, 2024, 9:15 p.m.