Learn R Programming

ciphertext (version 0.1.1)

affine: affine

Description

The affine cipher is a monoalphabetic substitutoin cipher, where each letter is enciphered with the function (ax+b) mod 26 (26 is the number of letters in the alphabet)

Usage

affine(word, a, b, encrypt = TRUE)

Value

a string

Arguments

word

Word or phrase to be encrypted

a

First parameter. This value and 26 must be coprime

b

Second parameter. Magnitude of the shift

encrypt

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

References

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

Examples

Run this code
affine("Hello", 1, -1)

Run the code above in your browser using DataLab