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

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

seed_cipher("Cowards die many times before their deaths")
#> [1] "'Ced<,#G,QhG$dXoG/Q$h#G+h(C<hG/0hQ<G,hd/0#"
seed_cipher("'Ced<,#G,QhG$dXoG/Q$h#G+h(C<hG/0hQ<G,hd/0#", decrypt = TRUE)
#> [1] "Cowards die many times before their deaths"
seed_cipher("Men willingly believe what they wish.", seed = 2354)
#> [1] ",7$HwF!!F$`!]H)7!F7d7Hw}q9H9}7]HwF^}B"
seed_cipher("q39l*D66D9;6.l%36D3d3l*<p4l4<3.l*D <h", seed = 2354, decrypt = TRUE)
#> [1] "a%t>$^{{^t+{(>q%{^%v%>$@2R>R@%(>$^3@W"
seed_cipher("the valiant never taste of death but once.", seed = -100)
#> [1] "*QDc3f>efk*ckD3D{c*fu*DcS'c]Df*Qcy%*cSkoDi"
seed_cipher("*QDc3f>efk*ckD3D{c*fu*DcS'c]Df*Qcy%*cSkoDi", seed = -100, decrypt = TRUE)
#> [1] "the valiant never taste of death but once."