Title: | Extremely Fast Hashing of R Objects, Raw Data and Files using 'xxHash' Algorithms |
---|---|
Description: | Extremely fast hashing of R objects using 'xxHash'. R objects are hashed via the standard serialization mechanism in R. Raw byte vectors and strings can be handled directly for compatibility with hashes created on other systems. This implementation is a wrapper around the 'xxHash' 'C' library which is available from <https://github.com/Cyan4973/xxHash>. |
Authors: | Mike Cheng [aut, cre, cph], Yann Collet [ctb, cph] (Author of the embedded xxhash library) |
Maintainer: | Mike Cheng <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.2 |
Built: | 2024-11-07 04:57:24 UTC |
Source: | https://github.com/coolbutuseless/xxhashlite |
This function will calculate the hash of any object understood by
base::serialize()
.
xxhash(robj, algo = "xxh128", as_raw = FALSE)
xxhash(robj, algo = "xxh128", as_raw = FALSE)
robj |
Any R object |
algo |
Select the specific xxhash algorithm. Default: 'xxh128'. (the latest algorithm in the xxhash family) Valid values: 'xxh32', 'xxh64', 'xxh128', 'xxh3' |
as_raw |
Return the hash as a raw vector of bytes instead of string?
Default: FALSE. If TRUE, then the raw bytes are returned in big-endian
order - which is what |
String representation of hash. If as_raw = TRUE
then a
raw vector is returned instead.
xxhash(mtcars) xxhash(mtcars, algo = 'xxh3', as_raw = TRUE)
xxhash(mtcars) xxhash(mtcars, algo = 'xxh3', as_raw = TRUE)
Calculate the hash of data from a connection object
xxhash_con(con, algo = "xxh128", as_raw = FALSE)
xxhash_con(con, algo = "xxh128", as_raw = FALSE)
con |
connection |
algo |
Select the specific xxhash algorithm. Default: 'xxh128'. (the latest algorithm in the xxhash family) Valid values: 'xxh32', 'xxh64', 'xxh128', 'xxh3' |
as_raw |
Return the hash as a raw vector of bytes instead of string?
Default: FALSE. If TRUE, then the raw bytes are returned in big-endian
order - which is what |
String representation of hash. If as_raw = TRUE
then a
raw vector is returned instead.
filename <- system.file('DESCRIPTION', package = 'base', mustWork = TRUE) xxhash_con(file(filename))
filename <- system.file('DESCRIPTION', package = 'base', mustWork = TRUE) xxhash_con(file(filename))
Calculate the hash of a file
xxhash_file(file, algo = "xxh128", as_raw = FALSE)
xxhash_file(file, algo = "xxh128", as_raw = FALSE)
file |
filename |
algo |
Select the specific xxhash algorithm. Default: 'xxh128'. (the latest algorithm in the xxhash family) Valid values: 'xxh32', 'xxh64', 'xxh128', 'xxh3' |
as_raw |
Return the hash as a raw vector of bytes instead of string?
Default: FALSE. If TRUE, then the raw bytes are returned in big-endian
order - which is what |
String representation of hash. If as_raw = TRUE
then a
raw vector is returned instead.
filename <- system.file('DESCRIPTION', package = 'base', mustWork = TRUE) xxhash_file(filename)
filename <- system.file('DESCRIPTION', package = 'base', mustWork = TRUE) xxhash_file(filename)
This performs a hash of the raw bytes - not of the serialized representation.
xxhash_raw(vec, algo = "xxh128", as_raw = FALSE)
xxhash_raw(vec, algo = "xxh128", as_raw = FALSE)
vec |
raw vector or single character string |
algo |
Select the specific xxhash algorithm. Default: 'xxh128'. (the latest algorithm in the xxhash family) Valid values: 'xxh32', 'xxh64', 'xxh128', 'xxh3' |
as_raw |
Return the hash as a raw vector of bytes instead of string?
Default: FALSE. If TRUE, then the raw bytes are returned in big-endian
order - which is what |
String representation of hash. If as_raw = TRUE
then a
raw vector is returned instead.
vec <- "hello" xxhash_raw(vec) vec <- as.raw(c(0x01, 0x02, 0x99)) xxhash_raw(vec)
vec <- "hello" xxhash_raw(vec) vec <- as.raw(c(0x01, 0x02, 0x99)) xxhash_raw(vec)