safer (version 0.1.0)

encrypt_object: Encrypt a R object

Description

encrypt_object encrypts a R object as a raw object or a string and decrypt_object decrypts a raw object or a string(encrypted by encrypt_object)

Usage

encrypt_object(object, ascii = FALSE, key = "pass", method = "symmetric")

Arguments

object

A R object to be encrypted

ascii

TRUE if the R object is to be encrypted as a string. Default is FALSE

key

A string without embbeded NULL. Default is 'pass'

method

Currently, a stub. It should be 'symmetric'(default)

Value

A raw object if ascii is FALSE. A string if ascii is TRUE.

Examples

Run this code
# NOT RUN {
temp <- encrypt_object(1:3)
all(
  is.raw(temp)
  , decrypt_object(temp) == 1:3)

temp <- encrypt_object(iris, ascii = TRUE)
all(
  is.character(temp)
  , decrypt_object(temp) == iris
  , identical(decrypt_object(temp), iris))
rm(temp)

# }

Run the code above in your browser using DataLab