decrypt: Decrypt an encrypted object

View source: R/encrypt.R

decryptR Documentation

Decrypt an encrypted object

Description

Decrypt an encrypted object

Usage

decrypt(src, key, additional_data = NULL)

Arguments

src

Raw vector or filename

key

The encryption key. This may be a character string, a 32-byte raw vector or a 64-character hex string (which encodes 32 bytes). When a shorter character string is given, a 32-byte key is derived using the Argon2 key derivation function.

additional_data

Additional data to include in the authentication. Raw vector or character string. Default: NULL. This additional data is not included with the encrypted data, but represents an essential component of the message authentication. The same additional_data must be presented during both encryption and decryption for the message to be authenticated. See vignette on 'Additional Data'.

Value

A decrypted R object

Examples

key <- argon2('my key')
encrypt(mtcars, key = key) |> 
  decrypt(key = key)

rmonocypher documentation built on April 4, 2025, 4:41 a.m.