sdlMurmur332 function

int sdlMurmur332(
  1. Pointer<NativeType> data,
  2. int len,
  3. int seed
)

Calculate a 32-bit MurmurHash3 value for a block of data.

https://en.wikipedia.org/wiki/MurmurHash

A seed may be specified, which changes the final results consistently, but this does not work like SDL_crc16 and SDL_crc32: you can't feed a previous result from this function back into itself as the next seed value to calculate a hash in chunks; it won't produce the same hash as it would if the same data was provided in a single call.

If you aren't sure what to provide for a seed, zero is fine. Murmur3 is not cryptographically secure, so it shouldn't be used for hashing top-secret data.

\param data the data to be hashed. \param len the size of data, in bytes. \param seed a value that alters the final hash value. \returns a Murmur3 32-bit hash value.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC Uint32 SDLCALL SDL_murmur3_32(const void *data, size_t len, Uint32 seed)

Implementation

int sdlMurmur332(Pointer<NativeType> data, int len, int seed) {
  final sdlMurmur332LookupFunction = libSdl3.lookupFunction<
      Uint32 Function(Pointer<NativeType> data, Uint32 len, Uint32 seed),
      int Function(
          Pointer<NativeType> data, int len, int seed)>('SDL_murmur3_32');
  return sdlMurmur332LookupFunction(data, len, seed);
}