Time33 is good at both efficiency and randomness. For a hash function, the criteria for evaluating its merits should be randomness, that is, the average degree of probability of entering the hash table for each unit (cell) of any group of specimens, because the more average the probability, the more evenly the data is distributed in the table, and the higher the space utilization rate of the table.
Times33 's algorithm is very simple, is constantly multiply by 33, see the following algorithm prototype.
hash (i) = hash (i-1) * + str[i]
The code is as follows:
Public Class Form1
Private Sub button1_click (sender as System.Object, E as System.EventArgs) Handles Button1.Click
Dim Myhash as ULong = 0
Dim mystr as String = TextBox1.Text
For i as Integer = 0 to Len (mystr)-1
Myhash = Myhash * + STRINGS.ASCW (mystr (i))
Next
TextBox2.Text = Myhash
End Sub
End Class
This article links http://www.cxybl.com/html/bcyy/net/20120604/27930.html