mirror of
https://github.com/zhengkai/orca.git
synced 2026-02-11 22:32:27 +08:00
up
This commit is contained in:
22
server/src/pb/req.go
Normal file
22
server/src/pb/req.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Hash ...
|
||||
func (x *Req) Hash() [16]byte {
|
||||
|
||||
m := md5.New()
|
||||
|
||||
io.WriteString(m, x.Method)
|
||||
m.Write([]byte{0x00})
|
||||
io.WriteString(m, x.Method)
|
||||
m.Write([]byte{0x00})
|
||||
m.Write(x.Body)
|
||||
|
||||
var h [16]byte
|
||||
copy(h[:], m.Sum(nil)[:])
|
||||
return h
|
||||
}
|
||||
Reference in New Issue
Block a user