Skip to contents

This can be used to create (encrypt) and solve (decrypt) an Atbash Cipher. An Atbash Cipher swaps letters' places in the alphabet. Thus, 'a' becomes 'z', 'b' becomes 'y', and so on. The function does not differentiate between the two.

The Atbash Cipher Wikipedia entry provides more information on the methods used: https://en.wikipedia.org/wiki/Atbash

Usage

atbash(x)

Arguments

x

A vector to be encoded or decoded.

Value

A character vector of length one that has been transformed

Examples

(e1 <- atbash("abcde"))
#> [1] "zyxwv"
atbash(e1)
#> [1] "abcde"

(e2 <- atbash("cipheR is a great R package!"))
#> [1] "xrksvI rh z tivzg I kzxpztv!"
atbash(e2)
#> [1] "cipheR is a great R package!"

(e3 <- atbash("Isn't this fun?"))
#> [1] "Rhm'g gsrh ufm?"
atbash(e3)
#> [1] "Isn't this fun?"