MemHash is the hash function used by go map, it utilizes available hardware instructions(behaves as aeshash if aes instruction is available). NOTE: The hash seed changes for every process. So, this cannot be used as a persistent hash.
(data []byte)
| 1036 | // as aeshash if aes instruction is available). |
| 1037 | // NOTE: The hash seed changes for every process. So, this cannot be used as a persistent hash. |
| 1038 | func MemHash(data []byte) uint64 { |
| 1039 | ss := (*stringStruct)(unsafe.Pointer(&data)) |
| 1040 | return uint64(memhash(ss.str, 0, uintptr(ss.len))) |
| 1041 | } |
| 1042 | |
| 1043 | // RandSlice is a helper to generate a random byte slice of the given size. |
| 1044 | func RandSlice(byteSize uint64) []byte { |