computeMessageDigest
Compute

Description

Computes the message digests of one or more files.

Usage

computeMessageDigest(files, algorithm)
computeMessageDigestFromBytes(bytes, algorithm)
listMessageDigestAlgorithms()

Arguments

files a character vector specifying the file names for which to compute the message digests. NAs or NULL are not allowed.
bytes a raw vector of bytes that are used to compute the message digest.
algorithm a character value specifying the name of the message digest algorithm to use. If the specified algorithm is unknown, an error is thrown.

Details

These functions use OpenSSL to compute message digests of files on disk.
Value
computeMessageDigestreturns a character vector containing the string representations of the calculated message digests. The names of this vector are the given file names. If the file name does not exist, if it is not a regular file, or if the function encounters any failures during computation, then as a result, NA is given for that file name.
computeMessageDigestFromBytesreturns a single string containing the calculated message digest for the raw vector bytes. This allows calculating message digests for bytes in memory.
listMessageDigestAlgorithmsreturns a character vector containing the names of the supported message digest algorithms.
See Also
md5sum
Examples
## list the supported message digest algorithms
listMessageDigestAlgorithms()

## compute the MD5 digest for a given raw vector computeMessageDigestFromBytes(as.raw(1:255), "MD5")

## Not run: ## equivalent to tools::md5sum(...) computeMessageDigest(c("file1.txt", "file2.bin", "file3.doc"), "MD5")

## SHA-1 computeMessageDigest("file4.zip", "SHA1") ## End(Not run)

Package terrUtils version 6.1.1-7
Package Index