affine: affine

View source: R/affine.R

affineR Documentation

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)

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.

Value

a string

References

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

Examples

affine("Hello", 1, -1)


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