caesar v1.0.0

0

Monthly downloads

0th

Percentile

Encrypts and Decrypts Strings

Encrypts and decrypts strings using either the Caesar cipher or a pseudorandom number generation (using set.seed()) method.

Readme

CRAN\_Status\_Badge AppVeyor Build
Status Build
Status Coverage
status

Overview

The goal of caesar is to encrypt and decrypt strings using a simple Caesar cipher or a pseudorandom number generation.

Installation

To install this package, use the code
install.packages("caesar")


# The development version is available on Github.
# install.packages("devtools")
devtools::install_github("jacobkap/caesar")

Usage

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.

caesar()

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::caesar(text = "As a rule, men worry more about what they can't see than about what they can.")
## [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::caesar(text = "As a rule, men worry more about what they can't see than about what they can.", 
        shift = -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::caesar(text = "Dvcdcuxoh cphqczruuBcpruhcderxwczkdwcwkhBcfdq,wcvhhcwkdqcderxwczkdwcwkhBcfdqa",
        decrypt = 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::caesar(text = "rj};}ilc>[}d>e}nfiip}dfi>};:flk}n/;k}k/>p}';e=k}j>>}k/;e};:flk}n/;k}k/>p}';e]", 
        shift = -100, 
        decrypt = TRUE)
## [1] "As a rule, men worry more about what they can't see than about what they can."

seed_cipher()

This method randomizes the alphabet based on a seed you set, making it far more secure than the Caesar cipher.

 caesar::seed_cipher(text = "As a rule, men worry more about what they can't see than about what they can.")
## [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.

 caesar::seed_cipher(text = "As a rule, men worry more about what they can't see than about what they can.", 
        seed = -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.

 caesar::seed_cipher(text = "R#GdG<VfhbG$hXGeC<<oG$C<hGd+CV/Ge0d/G/0hoGdXg/G#hhG/0dXGd+CV/Ge0d/G/0hoG dX_",
        decrypt = 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.

 caesar::seed_cipher(text = "Eucfc{%>Dc-Dkc8S{{$c-S{DcfyS%*c8Qf*c*QD$cofkR*cuDDc*QfkcfyS%*c8Qf*c*QD$cofki", 
        seed = -100, 
        decrypt = TRUE)
## [1] "As a rule men worry more about what they can't see than about what they can."

Functions in caesar

Name Description
caesar Encrypt and decrypt text using the Caesar cipher.
seed_cipher Encrypt and decrypt text using pseudorandom number generation based on the seed set.
No Results!

Vignettes of caesar

Name
Encrypting-and-decrypting-text.Rmd
No Results!

Last month downloads

Details

Type Package
License MIT + file LICENSE
Encoding UTF-8
LazyData true
URL https://github.com/jacobkap/caesar
BugReports https://github.com/jacobkap/caesar/issues
RoxygenNote 6.1.1
VignetteBuilder knitr
Language en-US
NeedsCompilation no
Packaged 2019-05-09 15:43:49 UTC; user
Repository CRAN
Date/Publication 2019-05-09 20:10:17 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/caesar)](http://www.rdocumentation.org/packages/caesar)