# 256-bit key
key <- sha256(charToRaw("This is a secret passphrase"))
msg <- serialize(iris, NULL)
# Encrypts with random nonce
cipher <- data_encrypt(msg, key)
orig <- data_decrypt(cipher, key)
stopifnot(identical(msg, orig))
# Tag the message with your key (HMAC)
tag <- data_tag(msg, key)
Run the code above in your browser using DataCamp Workspace