''djb2'' is a popular hash function. See e.g. here: http://www.cse.yorku.ca/~oz/hash.html Implementation is obvious but I ripped the code from Github user drslumps https://gist.github.com/drslump/647efb8204537f9faf2628eaba5a3577%|%djb2.tcl Gist%|% ====== proc djb2 {{input ""} {result 5381}} { foreach c [split $input ""] { set result [expr {($result << 5) + $result + [scan $c %c] & 0xFFFFFFFF}] } return $result } ======