User Tools

Site Tools


# $EPIC: hash_32bit.txt,v 1.3 2007/03/02 02:32:04 jnelson Exp $


$hash_32bit(<word> <length>)


  • The <word> and <length> arguments are dwords, which is different from most function arguments.
  • If the <word> argument is omitted the empty string is returned
  • If the <length> argument is omitted it defaults to 0
  • If the <length> argument is a negative number of is greater than 64, it is changed to 20.
  • The return value of this function is a 32 bit signed integer that is a “hash” of the first <length> characters in <word>.
  • Analytically speaking, hashing is a specific type of lossy compression.
  • All lossy compression techniques suffer from “collisions”. A collision occurs when two different <word>s yield the same return value. If you must avoid collisions, use $encode() instead.
  • The inverse of this principle is that all lossy compression techniques are irreversible. You cannot take the return value of this function and determine what <word> was. If you must be able to recreate <word>, use $encode() instead.
  • The return value of this function is deterministic within the lifetime of the client. The algorithm used to compute this value is subject to change in the future; you should not “save” the return value of this function to a file for use in future versions in epic.


You can use $hash_32bit() to convert an arbitrary string (perhaps containing characters that cannot be used in alias names) into a 32 bit signed integer value which you can use as part of an alias name. Collisions will occur. You cannot recover the original <word> from the output of this function. Please keep these in mind when using this function.


A 32 bit signed integer (it can be either negative or positive) that is deterministically derived from the first <length> characters in <word>.


$hash_32bit(“hello there”) returns 51439

hash_32bit.txt · Last modified: 2007/03/02 02:32 (external edit)