Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大小端问题 #5

Open
happyEgg opened this issue Feb 14, 2017 · 1 comment
Open

大小端问题 #5

happyEgg opened this issue Feb 14, 2017 · 1 comment

Comments

@happyEgg
Copy link

1、我将挑战码uint64类型转出[]byte,用的是大端转换的binary.Write(byteBuffer, binary.BigEndian, n)。。
func Int64ToByte(n uint64) []byte {
byteBuffer := bytes.NewBuffer([]byte{})
binary.Write(byteBuffer, binary.BigEndian, n)
return byteBuffer.Bytes()
}

func CheckMD5(num uint64) []byte {
h := md5.New()
h.Write(Int64ToByte(num))
h.Write([]byte("xxx"))

return h.Sum(nil)

}
2、而ServerID 却必须用小端转换才能读取正确。。

不能统一成大端或小端吗?
@idada

@bg5sbk
Copy link
Contributor

bg5sbk commented Feb 14, 2017

你好,这个肯定是可以做到的,只要你把protocol.go文件里面的大小端格式替换一下就可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants