1 Star 0 Fork 0

小鱼儿小董子/dongli-zinx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
examples
logo
zasync_op
zconf
zdecoder
ziface
zinterceptor
zinx-1.2.6
zinx_app_demo/mmo_game
zlog
znet
znotify
zpack
ztimer
zutils
fswatch.go
hash.go
shard_lock_map.go
shard_lock_map_bench_test.go
shard_lock_map_test.go
snowflake_uuid.go
snowflake_uuid_test.go
tls.go
witer.go
.gitattributes
.gitignore
.golangci.yaml
LICENSE
Makefile
README-CN.md
README.md
go.mod
go.sum
克隆/下载
hash.go 432 Bytes
一键复制 编辑 原始数据 按行查看 历史
小鱼儿小董子 提交于 2个月前 . first commit
package zutils
const (
Prime = 16777619
HashVal = 2166136261
)
type IHash interface {
Sum(string) uint32
}
type Fnv32Hash struct{}
func DefaultHash() IHash {
return &Fnv32Hash{}
}
// fnv32 algorithm
func (f *Fnv32Hash) Sum(key string) uint32 {
hashVal := uint32(HashVal)
prime := uint32(Prime)
keyLength := len(key)
for i := 0; i < keyLength; i++ {
hashVal *= prime
hashVal ^= uint32(key[i])
}
return hashVal
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanjimao/dongli-zinx.git
git@gitee.com:wanjimao/dongli-zinx.git
wanjimao
dongli-zinx
dongli-zinx
v0.0.1

搜索帮助