I have the following C code
uint32_t cHash32(const char *s, size_t len) { return util::Hash32(s, len); }
I am calling it from a go project as follows
func Hash32(s []byte) uint32 {
return uint32(C.cHash32((*C.char)(unsafe.Pointer(&s)), C.size_t(len(s))))
}
Somehow the result is broken.
When passing "hi" the expected result should be 4063302914 according to the python bindings to the same library (farmhash by google).
I guess that assuming s can be translated to a *C.char is a bit naive isn't it!
How do I pass the content of s as a *C.char?