seed_cipher: Encrypt and decrypt text using pseudorandom number generation...

Description Usage Arguments Value Examples

View source: R/caesar.R

Description

Encrypt and decrypt text using pseudorandom number generation based on the seed set.

Usage

1
seed_cipher(text, seed = 64, decrypt = FALSE)

Arguments

text

String to be ciphered or deciphered.

seed

A single number to set the seed which will pseudorandomly rearrange the original characters

decrypt

If TRUE (not default), deciphers the coded text.

Value

String of the ciphered/deciphered text

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
seed_cipher("Cowards die many times before their deaths")
seed_cipher("'Ced<,#G,QhG$dXoG/Q$h#G+h(C<hG/0hQ<G,hd/0#",
            decrypt = TRUE)

seed_cipher("Men willingly believe what they wish.",
             seed = 2354)
seed_cipher("q39l*D66D9;6.l%36D3d3l*<p4l4<3.l*D <h",
            seed = 2354,
            decrypt = TRUE)

seed_cipher("the valiant never taste of death but once.",
            seed = -100)
seed_cipher("*QDc3f>efk*ckD3D{c*fu*DcS'c]Df*Qcy%*cSkoDi",
            seed = -100,
            decrypt = TRUE)

Example output

[1] "'Ced<,#G,QhG$dXoG/Q$h#G+h(C<hG/0hQ<G,hd/0#"
[1] "Cowards die many times before their deaths"
[1] ",7$HwF!!F$`!]H)7!F7d7Hw}q9H9}7]HwF^}B"
[1] "a%t>$^{{^t+{(>q%{^%v%>$@2R>R@%(>$^3@W"
[1] "*QDc3f>efk*ckD3D{c*fu*DcS'c]Df*Qcy%*cSkoDi"
[1] "the valiant never taste of death but once."

caesar documentation built on Sept. 3, 2020, 5:06 p.m.