libcoap
4.3.0
|
Go to the source code of this file.
Macros | |
#define | min(a, b) (((a) < (b)) ? (a) : (b)) |
Naïve implementation of Murmur3 for 32 bit with update functionality. More... | |
Functions | |
static uint32_t | rol (uint32_t val, uint8_t bits) |
void | murmur3_32_init (murmur3_context_t *mctx) |
Initializes the provided murmur3 context object mctx . More... | |
static void | murmur3_32_eatblock (murmur3_context_t *mctx) |
static size_t | murmur3_32_fillblock (murmur3_context_t *mctx, const void *data, size_t len) |
void | murmur3_32_update (murmur3_context_t *mctx, const void *data, size_t len) |
Updates the state of the murmur3 context object mctx with len bytes from data . More... | |
uint32_t | murmur3_32_finalize (murmur3_context_t *mctx) |
Finalizes the given murmur3 context mctx and calculates the resulting murmur3 hash value. More... | |
uint32_t | murmur3_32 (const void *data, size_t len) |
Calculcates the murmur3 hash value of data . More... | |
Variables | |
const size_t | murmur3_block_length = sizeof(uint32_t) |
const uint32_t | c1 = 0xcc9e2d51 |
const uint32_t | c2 = 0x1b873593 |
const uint8_t | r1 = 15 |
const uint8_t | r2 = 13 |
const uint8_t | m = 5 |
const uint32_t | n = 0xe6546b64 |
#define min | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Naïve implementation of Murmur3 for 32 bit with update functionality.
See https://en.wikipedia.org/wiki/MurmurHash#Algorithm and https://github.com/aappleby/smhasher/wiki/MurmurHash3
Copyright (C) 2020 Olaf Bergmann bergm ann@ tzi.o rg
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
uint32_t murmur3_32 | ( | const void * | data, |
size_t | len | ||
) |
Calculcates the murmur3 hash value of data
.
This is a convenience function that encapsulates the required calls to murmur3_32_init(), murmur3_32_update(), and murmur3_32_finalize().
data | The data to hash. |
len | The actual length of data . |
Definition at line 145 of file murmur3.c.
|
static |
|
static |
uint32_t murmur3_32_finalize | ( | murmur3_context_t * | mctx | ) |
Finalizes the given murmur3 context mctx
and calculates the resulting murmur3 hash value.
mctx | The murmur3 context to update. |
mctx
. Definition at line 123 of file murmur3.c.
void murmur3_32_init | ( | murmur3_context_t * | mctx | ) |
void murmur3_32_update | ( | murmur3_context_t * | mctx, |
const void * | data, | ||
size_t | len | ||
) |
Updates the state of the murmur3 context object mctx
with len
bytes from data
.
mctx | The murmur3 context to update. |
data | The data to hash. |
len | The actual length of data . |
Definition at line 98 of file murmur3.c.
|
inlinestatic |