simple_substitution: simple_substitution

View source: R/simple_substitution.R

simple_substitutionR Documentation

simple_substitution

Description

simple substitution cipher. Each letter is monoalphabetically associated with a different one used for the encryption.

Usage

simple_substitution(word, key = "", seed = sample(1:1000, 1))

Arguments

word

Word or phrase to be encrypted

key

Word to be used as key for the encryption. If not provided, a random shuffle is performed

seed

Seed for reproducibility of the encryption if key is not provided

Value

a list with custom class "cipher", which modifies the printing defaults. The list contains the initial phrase (initial), the ciphered output (encrypted), and the alphabet order (keyalphabet)

Examples

simple_substitution("hello world", seed = 1234)
simple_substitution("hello world", key = "zebras")


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