Encrypt and Decrypt text using pseduorandom number generation

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

Arguments

text

String to be ciphered or deciphered

seed

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

decrypt

If TRUE, deciphers coded text

Value

String of the ciphered/deciphered text

Examples

seed_cipher("cats are friends!")
#> bc204c5d495ud?:08
#> [1] "bc204c5d495ud?:08"
seed_cipher("bc204c5d495ud?:08", decrypt = TRUE)
#> cats are friends!
#> [1] "cats are friends!"
seed_cipher("cats are friends!", seed = 2354)
#> li%1sid3szdp3 j1g
#> [1] "li%1sid3szdp3 j1g"
seed_cipher("li%1sid3szdp3 j1g", seed = 2354, decrypt = TRUE)
#> cats are friends!
#> [1] "cats are friends!"
seed_cipher("cats are #1 friend!", seed = -100)
#> hd2imdjpmfm-jcpe&q
#> [1] "hd2imdjpmfm-jcpe&q"
seed_cipher("hd2imdjpmfm-jcpe&q", seed = -100, decrypt = TRUE)
#> cats are 1 friend!
#> [1] "cats are 1 friend!"