playfair: playfair

View source: R/playfair.R

playfairR Documentation

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", encrypt = TRUE)

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

encrypt

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

Value

a string

References

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

Examples

playfair( "instruments", "monarchy", added_letter = "z")
playfair("gatlmzclrqtx", "monarchy", added_letter = "z", encrypt = FALSE)


ciphertext documentation built on April 4, 2025, 12:17 a.m.