SDL_murmur3_32(3)
π SDL_murmur3_32 π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_murmur3_32(3), and yes we are about to have a whole moment about hashing π¦
β¨ NAME β¨
SDL_murmur3_32</puruple> β calculate a 32-bit MurmurHash3 value for a block of data. that's it, that's the girl π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_stdinc.h>
Uint32 SDL_murmur3_32(const void *data, size_t len, Uint32 seed);
like, look at her. three little params and a dream πΈ
β¨ DESCRIPTION β¨
okay so first of all, if you wanna know what MurmurHash even is, the girls are linking the wikipedia page right here in the docs, iconic behaviour:
https://en.wikipedia.org/wiki/MurmurHash
you can specify a seed, and yes, it changes the final results consistently β same data plus same seed always gives you the same hash, no cap β¨
but listen to me very carefully bestie π¨ this does not work like SDL_crc16 and SDL_crc32. with those you can feed a previous result from the function back into itself as the next seed value and calculate a hash in chunks. with this one? nope. it will not produce the same hash as it would if the same data was provided in a single call. so don't try to be cute and stream it in pieces, because the math will simply not cooperate and you'll be sitting there like π
and if you're standing there like "what do i even put for a seed??" β zero is fine. zero is the vibe. zero ate. π«Ά
also important: Murmur3 is not cryptographically secure, so please do not use it for hashing top-secret data. that's not the assignment. put the state secrets down π
β¨ FUNCTION PARAMETERS β¨
dataβ the data to be hashed. the stuff. the material. the moment πlenβ the size ofdata, in bytes. count 'em, bestie π’seedβ a value that alters the final hash value. she's the little seasoning on top β¨
β¨ RETURN VALUE β¨
returns a Murmur3 32-bit hash value. one Uint32, freshly calculated, just for you π
β¨ THREAD SAFETY β¨
it is safe to call this function from any thread. so go off, spawn all the threads you want, she's not gonna be weird about it π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. so if you're on something older, no she's not there yet π
that's the whole page, you understood it, i'm so proud of you, go hash something π¦π
Simple Directmedia Layer wrote this one, SDL 3.4.18 is the version on the tin, and it's filed under SDL_murmur3_32(3) β mwah, periodt π
β¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms