hash()hashes an arbitrary R object.
hash_file()hashes the data contained in a file.
The generated hash is guaranteed to be reproducible across platforms that have the same endianness and are using the same R version.
hash(), a single character string containing the hash.
hash_file(), a character vector containing one hash per file.
These hashers use the XXH128 hash algorithm of the xxHash library, which generates a 128-bit hash. Both are implemented as streaming hashes, which generate the hash with minimal extra memory usage.
hash(), objects are converted to binary using R's native serialization
tools. On R >= 3.5.0, serialization version 3 is used, otherwise version 2 is
serialize() for more information about the serialization version.
hash(c(1, 2, 3)) #>  "702f7dd6e81ea41d26ea3b248627ece4" hash(mtcars) #>  "d0487363db4e6cc64fdb740cb6617fc0" authors <- file.path(R.home("doc"), "AUTHORS") copying <- file.path(R.home("doc"), "COPYING") hashes <- hash_file(c(authors, copying)) hashes #>  "d6c89b9f87c5db591875d539d3d6ab44" "cdb3a24318136e74f38209c219ca104b" # If you need a single hash for multiple files, # hash the result of `hash_file()` hash(hashes) #>  "82ee213b8ad1d973ef570b417cfdfa10"