I created a function to create a hash string that is consistent with Guava's implementation. Happy to submit a PR for the README since this might be a fairly common use case.
var hexDigits = []byte("0123456789abcdef")
func guavaHash(h1, h2 uint64) string {
buf := new(bytes.Buffer)
binary.Write(buf, binary.LittleEndian, h1)
binary.Write(buf, binary.LittleEndian, h2)
var result []byte
for _, curr := range buf.Bytes() {
result = append(result, hexDigits[(curr>>4)&0xf])
result = append(result, hexDigits[curr&0xf])
}
return string(result)
}
Originally wanted to do a BigInt version as well but since bytes are signed Java and unsigned in Go I passed on that exercise ;)
I created a function to create a hash string that is consistent with Guava's implementation. Happy to submit a PR for the README since this might be a fairly common use case.
Originally wanted to do a BigInt version as well but since bytes are signed Java and unsigned in Go I passed on that exercise ;)