New in openssl 0.3: hash functions
January 10, 2015
This week version 0.3 of the openssl package appeared on CRAN. New in this release are bindings to the cryptographic hashning functions in OpenSSL. Not exactly ground breaking (hashing functions have long been available from digest) but nice to have anyway. An overview from the new vignette:
Hashing functions
The functions sha1
, sha256
, sha512
, md4
, md5
and ripemd160
bind to the respective digest functions in OpenSSL’s libcrypto. Both binary and string inputs are supported and the output type will match the input type.
Functions are fully vectorized for the case of character vectors: a vector with n strings will return n hashes.
Besides character and raw vectors we can pass a connection object (e.g. a file, socket or url). In this case the function will stream-hash the binary contents of the conection.
Same for URLs. The hash of the R-3.1.1-win.exe
below should match the one in md5sum.txt
Compare to digest
Similar functionality is also available in the digest package, but with a slightly different interface: