Your IP : 216.73.216.48


Current Path : /usr/X11R6/share/epic5/help/6_Functions/
Upload File :
Current File : //usr/X11R6/share/epic5/help/6_Functions/hash_32bit

# $EPIC: hash_32bit,v 1.3 2002/01/13 00:27:11 anders Exp $
Synopsis:
   $hash_32bit(<word> <length>)

Technical:
   * 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.

Practical:
   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.

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

Examples:
   $hash_32bit("hello there")		returns 51439

See Also:
   encode(6)