EVOLUTION-MANAGER
Edit File: hash.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Hashing</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for hash {rlang}"><tr><td>hash {rlang}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Hashing</h2> <h3>Description</h3> <ul> <li> <p><code>hash()</code> hashes an arbitrary R object. </p> </li> <li> <p><code>hash_file()</code> hashes the data contained in a file. </p> </li></ul> <p>The generated hash is guaranteed to be reproducible across platforms that have the same endianness and are using the same R version. </p> <h3>Usage</h3> <pre> hash(x) hash_file(path) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An object.</p> </td></tr> <tr valign="top"><td><code>path</code></td> <td> <p>A character vector of paths to the files to be hashed.</p> </td></tr> </table> <h3>Details</h3> <p>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. </p> <p>For <code>hash()</code>, 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 used. See <code><a href="../../base/html/serialize.html">serialize()</a></code> for more information about the serialization version. </p> <h3>Value</h3> <ul> <li><p> For <code>hash()</code>, a single character string containing the hash. </p> </li> <li><p> For <code>hash_file()</code>, a character vector containing one hash per file. </p> </li></ul> <h3>Examples</h3> <pre> hash(c(1, 2, 3)) hash(mtcars) authors <- file.path(R.home("doc"), "AUTHORS") copying <- file.path(R.home("doc"), "COPYING") hashes <- hash_file(c(authors, copying)) hashes # If you need a single hash for multiple files, # hash the result of `hash_file()` hash(hashes) </pre> <hr /><div style="text-align: center;">[Package <em>rlang</em> version 1.0.6 <a href="00Index.html">Index</a>]</div> </body></html>