playfair {cryptography}R Documentation

Playfair Cipher

Description

This can be used to encrypt or decrypt a Playfair cipher. A Playfair cipher is a polygraphic substitution cipher that maps digrams of text to other elements of an encryption matrix which is generated by a keyword.

Usage

playfair(message, key, encrypt = TRUE)

Arguments

message

a character vector to be encrypted or decrypted

key

a character vector to be used as the encryption key

encrypt

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

Value

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

Examples

playfair("SUPERSECRETMESSAGE", "safety", encrypt = TRUE)
playfair("YSQFNTFDQTGRTAAFDT", "safety", encrypt = FALSE)
playfair("$%^Att&(a09Ck___He86re", "safety", encrypt = TRUE)
playfair("FSSFKPLSQT", "safety", encrypt = FALSE)


[Package cryptography version 1.0.0 Index]