hash: Hashing

View source: R/hash.R

hashR Documentation

Hashing

Description

Map an arbitrary character string to a shorter string of hexadecimal characters highly likely to be unique. It typically has a fixed width.

Arguments listed below are not validated for efficiency.

Usage

hash(lang = "", text = "", algorithm = "")

Arguments

lang

A non-empty and non-NA character string. The underlying language.

A language is usually a code (of two or three letters) for a native language name. While users retain full control over codes, it is best to use language codes stemming from well-known schemes such as IETF BCP 47, or ISO 639-1 to maximize portability and cross-compatibility.

text

A non-NA character string. It can be empty.

algorithm

A non-empty and non-NA character string equal to "sha1", or "utf8". The algorithm to use when hashing source information for identification purposes.

Details

Hashes generated by hash() uniquely identify the lang and text pair. Values passed to these arguments are concatenated with a colon character for hashing purposes.

Value

hash() returns a character string, or NULL if algorithm is not supported.

See Also

Translator, Text, normalize(), algorithms()


transltr documentation built on April 3, 2025, 9:33 p.m.