Hash

The Hash module provides a basic hashing algorithm.

API

class Util.Hash: LibTSMModule
staticmethod Calculate(data: any, hash?: number): number

Calculates the hash of the specified data.

This can handle data of type string or number. It can also handle a table being passed as the data assuming all keys and values of the table are also hashable (strings, numbers, or tables with the same restriction). This function uses the [djb2 algorithm](http://www.cse.yorku.ca/~oz/hash.html).

Parameters:
  • data (any) – The data to be hased

  • hash? (number) – The initial value of the hash