https://www.manniwood.com/2016_03_20/fun_with_java_string_hashing.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  
func ActualHash(s string) int32 {
      
var h int32
      
for i := 0; i < len(s); i++ {
          
h = 31*h + int32(s[i])
      
}
      
return h
  
}