digest2int: hash arbitrary string to integer

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/digest2int.R

Description

The digest2int function calculates integer hash of an arbitrary string. This is useful for radnomized experiments, feature hashing, etc.

Usage

1
digest2int(x, seed = 0L)

Arguments

x

An arbitrary character vector.

seed

an integer for algorithm initial state. Function will produce different hashes for same input and different seed values.

Value

The digest2int function returns integer vector of the same length as input vector x.

Author(s)

Dmitriy Selivanov [email protected] for the R interface; Bob Jenkins for original implementation http://www.burtleburtle.net/bob/hash/doobs.html

References

Jenkins's one_at_a_time hash: https://en.wikipedia.org/wiki/Jenkins_hash_function#one_at_a_time.

See Also

digest

Examples

1
2
3
current <- digest2int("The quick brown fox jumps over the lazy dog", 0L)
target <- 1369346549L
stopifnot(identical(target, current))

eddelbuettel/digest documentation built on July 13, 2019, 12:07 p.m.