NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_hash(n) 4.99.30 naviserver "NaviServer Built-in Commands"

Name

ns_hash - Compute a numeric hash value from a string

Table Of Contents

Synopsis

Description

This command takes an arbitrary value and computes from the value a numeric value (integer). It uses for hashing the Tcl hash function, such it does not have cryptograthic strength. This function is very weak against malicious strings; it is very easy to generate multiple keys that have the same hashcode. On the other hand, that hardly ever actually occurs. This function is very cheap and computes an integer value suitable as input for various functions.

The command is useful in combination of the modulo function e.g. for hash-based partitioning.

COMMANDS

ns_hash value

EXAMPLES

 % ns_hash "hello world"
 3255479292

See Also

ns_crypto, ns_hmac, ns_md, ns_md5, ns_sha1, nsd

Keywords

crypto, encoding, global built-in