Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hash

Hash an object


Description

hash() hashes an arbitrary R object.

The generated hash is guaranteed to be reproducible across platforms, but not across R versions.

Usage

hash(x)

Arguments

x

An object.

Details

hash() uses the XXH128 hash algorithm of the xxHash library, which generates a 128-bit hash. It is implemented as a streaming hash, which generates the hash with minimal extra memory usage.

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 serialize() for more information about the serialization version.

Examples

hash(c(1, 2, 3))
hash(mtcars)

rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.