Learn R Programming

cryptography (version 1.0.0)

autokey: Autokey Cipher

Description

This can be used to encrypt or decrypt an Autokey cipher. The Autokey Cipher is derived from the Vigenere Cipher, in which the key and plaintext are bound to generate a new encryption key for the Vigenere method. This Vigenere method uses only letters and numbers, as such any other characters used as inputs are not used in the cipher.

Usage

autokey(message, key, encrypt = TRUE)

Value

A character vector of either plaintext that has been encrypted or ciphertext that has been decrypted.

Arguments

message

A character vector of plaintext to be encrypted or ciphertext to be decrypted

key

A character vector to be used as the encryption key

encrypt

(Default: TRUE) TRUE will encrypt the message, while FALSE will decrypt the message.

Examples

Run this code
autokey("VerySecretMessage", "Hack", encrypt = TRUE)
autokey("c4JYn8JfwNoLMbmAM", "Hack", encrypt = FALSE)
autokey("Very $%^&SecretMes(*sag£$%e", "Hack", encrypt = TRUE)

Run the code above in your browser using DataLab