1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-27 17:45:24 +00:00
OpenDiablo2/d2common/d2fileformats/d2animdata/hash.go

19 lines
290 B
Go
Raw Normal View History

package d2animdata
import "strings"
type hashTable [numBlocks]byte
func hashName(name string) byte {
hashBytes := []byte(strings.ToUpper(name))
var hash uint32
for hashByteIdx := range hashBytes {
hash += uint32(hashBytes[hashByteIdx])
}
hash %= numBlocks
return byte(hash)
}