HashString

The HashString function calculates a hash value from a specified string.

Syntax

  Copy imageCopy Code
int HashString(
  string input,
  int multiplier,
  int maxValue,
  bool caseSensitive
);

Parameters

input

Specifies the string to be hashed.

multiplier

Specifies the value by which the byte value of each character in the input string is multiplied. A 32-bit integer.

maxValue

Specifies the maximum value of the return value. A 32-bit integer. If maxValue is zero, the script terminates with a divide-by-zero error.

caseSensitive

If true, uppercase characters in the input string are converted to lowercase prior to calculating the return value.

Return Values

Returns a 32-bit integer. The return value is calculated by iterating through each character in the string specified by input, multiplying the byte value of the character by the value specified by multiplier, and then accumulating the product of this multiplication in a running total. After all of the characters in the string have been processed, the value returned is the total value specified by maxValue (that is, total % maxValue).