R implementation of a Vigniere cypher.
Contains four functions:
-
encrypt(plaintext, key)
Encrypts the stringplaintext
using the keykey
.key
is recycled as many times as is necessary to match the length ofplaintext
. -
decrypt(cyphertext, key)
Decrypts the stringcyphertext
using the keykey
. -
modulo_add(i, m, n)
andmodulo_subtract(i, m, n)
Adds (subtracts)m
toi
modulon
. Differs from the default R%%
implentation in that zero is excluded, somodulo_subtract(1, 1)
returns 26, not 0 (compare with base R(1 - 1) %% 26
.n
defaults to 26 as it is intended for use with the alphabet.