Learn R Programming

ciphertext (version 0.1.0)

playfair: playfair

Description

The Playfair cipher is a symmetric method which encrypts pairs of letters using a modified Polybius square

Usage

playfair(word, key, added_letter = "x", decrypt = FALSE)

Value

a string

Arguments

word

Word or phrase to be encrypted or decrypted

key

Word for creating the modified Polybius square

added_letter

Letter to be added in case two letters of a pair are identical; usually "x" is used

decrypt

If `FALSE` (default), the program ciphers the input word, If `TRUE`, the program decrypts it.

References

https://en.wikipedia.org/wiki/Playfair_cipher

Examples

Run this code
playfair( "instruments", "monarchy", added_letter = "z")
playfair("gatlmzclrqtx", "monarchy", added_letter = "z", decrypt = TRUE)

Run the code above in your browser using DataLab