| hash_animal {cli} | R Documentation |
Adjective-animal hash
hash_animal(x, n_adj = 2)
x |
Character vector. |
n_adj |
Number of adjectives to use. It must be between 0 and 3. |
It uses the first 13 hexadecimal characters (out of the 32) of the MD5 hash of the input, and converts them into an adjective-animal form to create a human readable hash.
hash_animals() uses 1748 animal names and
8946 different adjectives. The number of
different hashes you can get for different values of n_adj:
n_adj | size of the hash table space |
| 0 | 1,748 |
| 1 | 15,637,608 |
| 2 | 139,894,041,168 |
| 3 | 1,251,492,092,288,928 |
The list of adjectives and animals comes from the ids package, and in turn from https://github.com/a-type/adjective-adjective-animal, and from https://gfycat.com.
A data frame with columns
hash: the hash value, a string.
words: list column with the adjectives and the animal name in a
character vector.
the ids package for generating random adjective-animal ids
Other hash functions:
hash_emoji(),
hash_md5()
hash_animal(c("foo", "bar"))
# if you increase `n_adj`, the shorter hash is a suffix of the longer:
hash_animal("cli package", 0)$hash
hash_animal("cli package", 1)$hash
hash_animal("cli package", 2)$hash
hash_animal("cli package", 3)$hash