MCPcopy
hub / github.com/davyxu/cellnet / StringHash

Function StringHash

util/codec.go:12–22  ·  view source on GitHub ↗

字符串转为16位整形哈希

(s string)

Source from the content-addressed store, hash-verified

10
11// 字符串转为16位整形哈希
12func StringHash(s string) (hash uint16) {
13
14 for _, c := range s {
15
16 ch := uint16(c)
17
18 hash = hash + ((hash) << 5) + ch + (ch << 7)
19 }
20
21 return
22}
23
24// 字节计算MD5
25func BytesMD5(data []byte) string {

Callers 6

initFunction · 0.92
initFunction · 0.92
MsgIDMethod · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected