md5 {md5} | R Documentation |
md5
computes MD5 hash of a vector. Currently the only supported
vectors are integer, real and raw.
md5(x, raw = FALSE)
x |
vector |
raw |
if set to |
The hash is computed on the binary representation of the vector, so the
hash of numeric vectors will differ on machines with a different
endianness (use serialize
if that is an issue).
If raw
is FALSE
then a character vector of length one with
the one element having 32 characters representing the hash in
hexadecimal notation. Otherwise a raw vector of length 16 representing
the hash.
This function is deliberately very simple, does not perform hashing
of recursive objects and ignores attributes. This is due to the
original intended use - it is always possible to use
serialize
for hashing of complex obejcts.
## classic examples from the literature to verify correctness: ## should be 9e107d9d372bb6826bd81d3542a419d6 md5(charToRaw("The quick brown fox jumps over the lazy dog")) ## empty vector should be d41d8cd98f00b204e9800998ecf8427e md5(integer(0)) ## other, random examples md5(1:10) md5(1:10, TRUE)