The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The goal of caesar is to encrypt and decrypt strings using a simple Caesar cipher or a pseudorandom number generation.
To install this package, use the codeinstall.packages("caesar")
# The development version is available on Github.
# install.packages("devtools")
::install_github("jacobkap/caesar") devtools
library(caesar)
There are two functions in this package:
caesar()
uses a traditional Caesar cipher to encrypt or
decrypt text.seed_cipher()
encrypts or decrypts text based on a
specific seed.For both functions the only required parameter is text
which is a string or vector of string that you want to encrypt/decrypt.
The functions will output a string with the text encrypted (or
decrypted). If you do decide to change the default value of the
shift
parameter (seed
in
seed_cipher()
), which you should to make it secure, make
sure not to forget the value you set.
The Caesar cipher is an ancient cipher which is made by shifting the letters of the alphabet by a set number. So a shift of -3, for example, would move each letter to the left by 3, such that A would become X and D would become A. For this package it also includes numbers and punctuation but the concept is the same.
::caesar(text = "As a rule, men worry more about what they can't see than about what they can.") caesar
## [1] "Dvcdcuxoh cphqczruuBcpruhcderxwczkdwcwkhBcfdq,wcvhhcwkdqcderxwczkdwcwkhBcfdqa"
You can set the shift yourself as one of the optional parameters.
This can be any whole number (positive or negative). If you do decide to
change the default value of the shift
parameter (which you
should to make it secure), make sure not to forget the value you
set.
::caesar(text = "As a rule, men worry more about what they can't see than about what they can.",
caesarshift = -100)
## [1] "rj};}ilc>[}d>e}nfiip}dfi>};:flk}n/;k}k/>p}';e=k}j>>}k/;e};:flk}n/;k}k/>p}';e]"
To decrypt the text change the parameter decrypt
to
TRUE.
::caesar(text = "Dvcdcuxoh cphqczruuBcpruhcderxwczkdwcwkhBcfdq,wcvhhcwkdqcderxwczkdwcwkhBcfdqa",
caesardecrypt = TRUE)
## [1] "As a rule, men worry more about what they can't see than about what they can."
Make sure the shift value is the same as it was when encrypted.
::caesar(text = "rj};}ilc>[}d>e}nfiip}dfi>};:flk}n/;k}k/>p}';e=k}j>>}k/;e};:flk}n/;k}k/>p}';e]",
caesarshift = -100,
decrypt = TRUE)
## [1] "As a rule, men worry more about what they can't see than about what they can."
This method randomizes the alphabet based on a seed you set, making it far more secure than the Caesar cipher.
::seed_cipher(text = "As a rule, men worry more about what they can't see than about what they can.") caesar
## [1] "R#GdG<VfhbG$hXGeC<<oG$C<hGd+CV/Ge0d/G/0hoG dXg/G#hhG/0dXGd+CV/Ge0d/G/0hoG dX_"
You can set the seed yourself as one of the optional parameters. This
can be any whole number (positive or negative). If you do decide to
change the default value of the seed
parameter (which you
should to make it secure), make sure not to forget the value you
set.
::seed_cipher(text = "As a rule, men worry more about what they can't see than about what they can.",
caesarseed = -100)
## [1] "Eucfc{%>D c-Dkc8S{{$c-S{DcfyS%*c8Qf*c*QD$cofkR*cuDDc*QfkcfyS%*c8Qf*c*QD$cofki"
To decrypt the text change the parameter decrypt
to
TRUE.
::seed_cipher(text = "R#GdG<VfhbG$hXGeC<<oG$C<hGd+CV/Ge0d/G/0hoGdXg/G#hhG/0dXGd+CV/Ge0d/G/0hoG dX_",
caesardecrypt = TRUE)
## [1] "As a rule, men worry more about what they an't see than about what they can."
Make sure the seed value is the same as it was when encrypted.
::seed_cipher(text = "Eucfc{%>Dc-Dkc8S{{$c-S{DcfyS%*c8Qf*c*QD$cofkR*cuDDc*QfkcfyS%*c8Qf*c*QD$cofki",
caesarseed = -100,
decrypt = TRUE)
## [1] "As a rule men worry more about what they can't see than about what they can."
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.