Learn R Programming

nanonext (version 0.5.4)

sha384: Cryptographic Hashing Using the SHA-384 Algorithm

Description

Returns a SHA-384 hash or HMAC of the supplied R object. Uses the optimised implementation from the Mbed TLS library.

Usage

sha384(x, key = NULL)

Value

A 'nanoHash' object - raw vector of length 48.

Arguments

x

an object.

key

(optional) supply a secret key to generate an HMAC. If missing or NULL, the SHA-384 hash of 'x' is returned.

Details

For arguments 'x' and 'key', a raw vector is hashed directly, a character string is converted using charToRaw, whilst other objects are serialised first.

Use as.character() to convert the returned raw vector to a single character string.

Examples

Run this code
sha384("hello world!")

# Converts to a character string:
as.character(sha384("hello world!"))

# Obtain HMAC:
sha384("hello world!", "SECRET_KEY")

Run the code above in your browser using DataLab