mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-10 10:36:42 -05:00
19 lines
290 B
Go
19 lines
290 B
Go
|
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)
|
||
|
}
|