caesar {caesar}R Documentation

Encrypt and decrypt text using the Caesar cipher.

Description

Encrypt and decrypt text using the Caesar cipher.

Usage

caesar(text, shift = 3, decrypt = FALSE)

Arguments

text

String to be ciphered or deciphered.

shift

A single whole number for how far to move the characters in the direction (positive or negative) you choose. If not a whole number, it will be rounded to nearest whole number.

decrypt

If TRUE, (not default) deciphers the coded text.

Value

String of the ciphered/deciphered text

Examples

# Please see this for more info.
# https://en.wikipedia.org/wiki/Caesar_cipher

caesar("Experience is the teacher of all things.")
caesar("HAshulhqfhclvcwkhcwhdfkhucricdoocwklqjva", decrypt = TRUE)

caesar("Veni, vidi, vici.",  shift = 40)
caesar(",S1WKN9WRWKN9WQWL", shift = 40, decrypt = TRUE)

caesar("No one is so brave that he is not disturbed by something unexpected.", shift = -12)
caesar("Bc[cb:[,g[gc[{f]j:[h>]h[>:[,g[bch[;,ghif{:;[{m[gca:h>,b<[ib:ld:}h:;`",
       shift = -12, decrypt = TRUE)

[Package caesar version 1.1.0 Index]