Hash Functions
This topic describes C8QL hash functions.
HASH()
HASH(value) → hashNumber
Calculate a hash value for value.
- value (any): an element of arbitrary type
- returns hashNumber (number): a hash value of value
value is not required to be a string, but can have any data type. The calculated hash value will take the data type of value into account, so for example the number 1 and the string "1" will have different hash values. For arrays the hash values will be equal if the arrays contain exactly the same values (including value types) in the same order. For objects the same hash values will be created if the objects have exactly the same attribute names and values (including value types). The order in which attributes appear inside objects is not important for hashing.
The hash value returned by this function is a number. The hash algorithm is not guaranteed to remain the same in future versions of GDN. The hash values should therefore be used only for temporary calculations, e.g. to compare if two documents are the same, or for grouping values in queries.
String-based hashing
See the following string functions: