sha1: Cryptographic Hashing Using the SHA-1 Algorithm
Description
Returns a SHA-1 hash or HMAC of the supplied R object. Uses the optimised
implementation from the Mbed TLS library. For secure applications, one of
the SHA-2 algorithms such as sha256 should be considered
instead.
Usage
sha1(x, key = NULL, convert = TRUE)
Value
A raw vector or character string depending on 'convert', of byte
length 20.
Arguments
x
an object.
key
(optional) supply a secret key to generate an HMAC. If missing or
NULL, the SHA-1 hash of 'x' is returned.
convert
[default TRUE] logical value whether to convert the output to
a character string or keep as a raw vector. Supplying a non-logical value
will error.
Details
For arguments 'x' and 'key', a scalar string or raw vector (with no
attributes) is hashed directly, whilst all other objects are serialised
first.
The result of hashing is always a raw vector, which is translated to a
character string if 'convert' is TRUE, or returned directly if 'convert'
is FALSE.