char *ascii = qhex_encode(hash, 16);
printf("Hex encoded Murmur3: %s\n", ascii);
free(ascii);
-bool qhashmurmur3_128(const void *data, size_t nbytes, void *retbuf)
Get 128-bit Murmur3 hash.
+bool qhashmurmur3_128(const void *data, size_t nbytes, void *retbuf)
Get 128-bit Murmur3 hash.
-Definition at line 330 of file qhash.c.
+Definition at line 335 of file qhash.c.
diff --git a/doc/html/qhash_8c_source.html b/doc/html/qhash_8c_source.html
index b4200184..bb238b8b 100644
--- a/doc/html/qhash_8c_source.html
+++ b/doc/html/qhash_8c_source.html
@@ -181,332 +181,337 @@
-
-
- 122 if (lseek(fd, offset, SEEK_SET) != offset) {
-
-
-
-
-
-
-
- 130 ssize_t toread, nread;
- 131 unsigned char buf[32 * 1024];
- 132 for (toread = nbytes; toread > 0; toread -= nread) {
- 133 if (toread >
sizeof(buf))
- 134 nread = read(fd, buf,
sizeof(buf));
-
- 136 nread = read(fd, buf, toread);
-
-
- 139 MD5Update(&context, buf, nread);
-
-
-
-
- 144 MD5Final(retbuf, &context);
-
-
-
-
-
-
-
-
-
-
-
+
+
+ 122 nbytes = size - offset;
+
+
+
+
+ 127 if (lseek(fd, offset, SEEK_SET) != offset) {
+
+
+
+
+
+
+
+ 135 ssize_t toread, nread;
+ 136 unsigned char buf[32 * 1024];
+ 137 for (toread = nbytes; toread > 0; toread -= nread) {
+ 138 if (toread >
sizeof(buf))
+ 139 nread = read(fd, buf,
sizeof(buf));
+
+ 141 nread = read(fd, buf, toread);
+
+
+ 144 MD5Update(&context, buf, nread);
+
+
+
+
+ 149 MD5Final(retbuf, &context);
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 188 if (data == NULL || nbytes == 0)
-
-
-
- 192 uint32_t h = 0x811C9DC5;
-
- 194 for (dp = (
unsigned char *) data; *dp && nbytes > 0; dp++, nbytes--) {
-
- 196 h += (h<<1) + (h<<4) + (h<<7) + (h<<8) + (h<<24);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 193 if (data == NULL || nbytes == 0)
+
+
+
+ 197 uint32_t h = 0x811C9DC5;
+
+ 199 for (dp = (
unsigned char *) data; *dp && nbytes > 0; dp++, nbytes--) {
+
+ 201 h += (h<<1) + (h<<4) + (h<<7) + (h<<8) + (h<<24);
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- 219 if (data == NULL || nbytes == 0)
-
-
-
- 223 uint64_t h = 0xCBF29CE484222325ULL;
-
- 225 for (dp = (
unsigned char *) data; *dp && nbytes > 0; dp++, nbytes--) {
-
- 227 h += (h << 1) + (h << 4) + (h << 5) +
- 228 (h << 7) + (h << 8) + (h << 40);
-
- 230 h *= 0x100000001B3ULL;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 224 if (data == NULL || nbytes == 0)
+
+
+
+ 228 uint64_t h = 0xCBF29CE484222325ULL;
+
+ 230 for (dp = (
unsigned char *) data; *dp && nbytes > 0; dp++, nbytes--) {
+
+ 232 h += (h << 1) + (h << 4) + (h << 5) +
+ 233 (h << 7) + (h << 8) + (h << 40);
+
+ 235 h *= 0x100000001B3ULL;
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- 259 if (data == NULL || nbytes == 0)
-
-
- 262 const uint32_t c1 = 0xcc9e2d51;
- 263 const uint32_t c2 = 0x1b873593;
-
- 265 const int nblocks = nbytes / 4;
- 266 const uint32_t *blocks = (
const uint32_t *) (data);
- 267 const uint8_t *tail = (
const uint8_t *) (data + (nblocks * 4));
-
-
-
-
-
- 273 for (i = 0; i < nblocks; i++) {
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 264 if (data == NULL || nbytes == 0)
+
+
+ 267 const uint32_t c1 = 0xcc9e2d51;
+ 268 const uint32_t c2 = 0x1b873593;
+
+ 270 const int nblocks = nbytes / 4;
+ 271 const uint32_t *blocks = (
const uint32_t *) (data);
+ 272 const uint8_t *tail = (
const uint8_t *) (data + (nblocks * 4));
+
+
-
- 277 k = (k << 15) | (k >> (32 - 15));
-
-
-
- 281 h = (h << 13) | (h >> (32 - 13));
- 282 h = (h * 5) + 0xe6546b64;
-
+
+
+ 278 for (i = 0; i < nblocks; i++) {
+
+
+
+ 282 k = (k << 15) | (k >> (32 - 15));
+
-
- 286 switch (nbytes & 3) {
-
-
-
-
-
-
-
- 294 k = (k << 15) | (k >> (32 - 15));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 286 h = (h << 13) | (h >> (32 - 13));
+ 287 h = (h * 5) + 0xe6546b64;
+
+
+
+ 291 switch (nbytes & 3) {
+
+
+
+
+
+
+
+ 299 k = (k << 15) | (k >> (32 - 15));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- 331 if (data == NULL || nbytes == 0)
-
-
- 334 const uint64_t c1 = 0x87c37b91114253d5ULL;
- 335 const uint64_t c2 = 0x4cf5ad432745937fULL;
-
- 337 const int nblocks = nbytes / 16;
- 338 const uint64_t *blocks = (
const uint64_t *) (data);
- 339 const uint8_t *tail = (
const uint8_t *) (data + (nblocks * 16));
-
-
-
-
-
-
- 346 for (i = 0; i < nblocks; i++) {
- 347 k1 = blocks[i * 2 + 0];
- 348 k2 = blocks[i * 2 + 1];
-
-
- 351 k1 = (k1 << 31) | (k1 >> (64 - 31));
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 336 if (data == NULL || nbytes == 0)
+
+
+ 339 const uint64_t c1 = 0x87c37b91114253d5ULL;
+ 340 const uint64_t c2 = 0x4cf5ad432745937fULL;
+
+ 342 const int nblocks = nbytes / 16;
+ 343 const uint64_t *blocks = (
const uint64_t *) (data);
+ 344 const uint8_t *tail = (
const uint8_t *) (data + (nblocks * 16));
+
+
+
+
+
+
+ 351 for (i = 0; i < nblocks; i++) {
+ 352 k1 = blocks[i * 2 + 0];
+ 353 k2 = blocks[i * 2 + 1];
- 355 h1 = (h1 << 27) | (h1 >> (64 - 27));
-
- 357 h1 = h1 * 5 + 0x52dce729;
-
-
- 360 k2 = (k2 << 33) | (k2 >> (64 - 33));
-
-
+
+ 356 k1 = (k1 << 31) | (k1 >> (64 - 31));
+
+
+
+ 360 h1 = (h1 << 27) | (h1 >> (64 - 27));
+
+ 362 h1 = h1 * 5 + 0x52dce729;
- 364 h2 = (h2 << 31) | (h2 >> (64 - 31));
-
- 366 h2 = h2 * 5 + 0x38495ab5;
-
+
+ 365 k2 = (k2 << 33) | (k2 >> (64 - 33));
+
+
-
- 370 switch (nbytes & 15) {
-
- 372 k2 ^= (uint64_t)(tail[14]) << 48;
-
- 374 k2 ^= (uint64_t)(tail[13]) << 40;
-
- 376 k2 ^= (uint64_t)(tail[12]) << 32;
-
- 378 k2 ^= (uint64_t)(tail[11]) << 24;
-
- 380 k2 ^= (uint64_t)(tail[10]) << 16;
-
- 382 k2 ^= (uint64_t)(tail[9]) << 8;
-
- 384 k2 ^= (uint64_t)(tail[8]) << 0;
-
- 386 k2 = (k2 << 33) | (k2 >> (64 - 33));
-
-
-
-
- 391 k1 ^= (uint64_t)(tail[7]) << 56;
-
- 393 k1 ^= (uint64_t)(tail[6]) << 48;
-
- 395 k1 ^= (uint64_t)(tail[5]) << 40;
-
- 397 k1 ^= (uint64_t)(tail[4]) << 32;
-
- 399 k1 ^= (uint64_t)(tail[3]) << 24;
-
- 401 k1 ^= (uint64_t)(tail[2]) << 16;
-
- 403 k1 ^= (uint64_t)(tail[1]) << 8;
-
- 405 k1 ^= (uint64_t)(tail[0]) << 0;
-
- 407 k1 = (k1 << 31) | (k1 >> (64 - 31));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 422 h1 *= 0xff51afd7ed558ccdULL;
-
- 424 h1 *= 0xc4ceb9fe1a85ec53ULL;
-
-
-
- 428 h2 *= 0xff51afd7ed558ccdULL;
-
- 430 h2 *= 0xc4ceb9fe1a85ec53ULL;
-
-
-
-
-
- 436 ((uint64_t *) retbuf)[0] = h1;
- 437 ((uint64_t *) retbuf)[1] = h2;
-
-
-
+ 369 h2 = (h2 << 31) | (h2 >> (64 - 31));
+
+ 371 h2 = h2 * 5 + 0x38495ab5;
+
+
+
+ 375 switch (nbytes & 15) {
+
+ 377 k2 ^= (uint64_t)(tail[14]) << 48;
+
+ 379 k2 ^= (uint64_t)(tail[13]) << 40;
+
+ 381 k2 ^= (uint64_t)(tail[12]) << 32;
+
+ 383 k2 ^= (uint64_t)(tail[11]) << 24;
+
+ 385 k2 ^= (uint64_t)(tail[10]) << 16;
+
+ 387 k2 ^= (uint64_t)(tail[9]) << 8;
+
+ 389 k2 ^= (uint64_t)(tail[8]) << 0;
+
+ 391 k2 = (k2 << 33) | (k2 >> (64 - 33));
+
+
+
+
+ 396 k1 ^= (uint64_t)(tail[7]) << 56;
+
+ 398 k1 ^= (uint64_t)(tail[6]) << 48;
+
+ 400 k1 ^= (uint64_t)(tail[5]) << 40;
+
+ 402 k1 ^= (uint64_t)(tail[4]) << 32;
+
+ 404 k1 ^= (uint64_t)(tail[3]) << 24;
+
+ 406 k1 ^= (uint64_t)(tail[2]) << 16;
+
+ 408 k1 ^= (uint64_t)(tail[1]) << 8;
+
+ 410 k1 ^= (uint64_t)(tail[0]) << 0;
+
+ 412 k1 = (k1 << 31) | (k1 >> (64 - 31));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 427 h1 *= 0xff51afd7ed558ccdULL;
+
+ 429 h1 *= 0xc4ceb9fe1a85ec53ULL;
+
+
+
+ 433 h2 *= 0xff51afd7ed558ccdULL;
+
+ 435 h2 *= 0xc4ceb9fe1a85ec53ULL;
+
+
+
+
+
+ 441 ((uint64_t *) retbuf)[0] = h1;
+ 442 ((uint64_t *) retbuf)[1] = h2;
+
+
+
bool qhashmd5(const void *data, size_t nbytes, void *retbuf)
Calculate 128-bit(16-bytes) MD5 hash.
-uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
-uint64_t qhashfnv1_64(const void *data, size_t nbytes)
Get 64-bit FNV1 hash integer.
-bool qhashmurmur3_128(const void *data, size_t nbytes, void *retbuf)
Get 128-bit Murmur3 hash.
-uint32_t qhashfnv1_32(const void *data, size_t nbytes)
Get 32-bit FNV1 hash.
+uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
+uint64_t qhashfnv1_64(const void *data, size_t nbytes)
Get 64-bit FNV1 hash integer.
+bool qhashmurmur3_128(const void *data, size_t nbytes, void *retbuf)
Get 128-bit Murmur3 hash.
+uint32_t qhashfnv1_32(const void *data, size_t nbytes)
Get 32-bit FNV1 hash.
bool qhashmd5_file(const char *filepath, off_t offset, ssize_t nbytes, void *retbuf)
Get 128-bit MD5 hash of a file contents.
diff --git a/doc/html/qhasharr_8c_source.html b/doc/html/qhasharr_8c_source.html
index b7e0d780..49818bc7 100644
--- a/doc/html/qhasharr_8c_source.html
+++ b/doc/html/qhasharr_8c_source.html
@@ -1170,7 +1170,7 @@
bool qhashmd5(const void *data, size_t nbytes, void *retbuf)
Calculate 128-bit(16-bytes) MD5 hash.
-uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
+uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
void qhasharr_clear(qhasharr_t *tbl)
qhasharr->clear(): Clears this table so that it contains no keys.
int qhasharr_size(qhasharr_t *tbl, int *maxslots, int *usedslots)
qhasharr->size(): Returns the number of objects in this table.
bool qhasharr_put_by_obj(qhasharr_t *tbl, const void *name, size_t namesize, const void *data, size_t datasize)
qhasharr->put_by_obj(): ut an object into this table by key object.
diff --git a/doc/html/qhashtbl_8c_source.html b/doc/html/qhashtbl_8c_source.html
index f2244a3a..30abf16e 100644
--- a/doc/html/qhashtbl_8c_source.html
+++ b/doc/html/qhashtbl_8c_source.html
@@ -777,7 +777,7 @@
713 Q_MUTEX_DESTROY(tbl->qmutex);
-uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
+uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
bool qhashtbl_remove(qhashtbl_t *tbl, const char *name)
qhashtbl->remove(): Remove an object from this table.
bool qhashtbl_debug(qhashtbl_t *tbl, FILE *out)
qhashtbl->debug(): Print hash table for debugging purpose
void qhashtbl_clear(qhashtbl_t *tbl)
qhashtbl->clear(): Clears this hashtable so that it contains no keys.
diff --git a/doc/html/qlisttbl_8c_source.html b/doc/html/qlisttbl_8c_source.html
index b9eed9fd..68015d27 100644
--- a/doc/html/qlisttbl_8c_source.html
+++ b/doc/html/qlisttbl_8c_source.html
@@ -1223,7 +1223,7 @@
char * qurl_encode(const void *bin, size_t size)
Encode data using URL encoding(Percent encoding) algorithm.
size_t qurl_decode(char *str)
Decode URL encoded string.
void * qfile_load(const char *filepath, size_t *nbytes)
Load file into memory.
-uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
+uint32_t qhashmurmur3_32(const void *data, size_t nbytes)
Get 32-bit Murmur3 hash.
ssize_t qio_printf(int fd, int timeoutms, const char *format,...)
Formatted output to a file descriptor.
qlisttbl_data_t * qlisttbl_getmulti(qlisttbl_t *tbl, const char *name, bool newmem, size_t *numobjs)
qlisttbl->getmulti(): Finds all objects with given name and return a array of objects.
bool qlisttbl_put(qlisttbl_t *tbl, const char *name, const void *data, size_t size)
qlisttbl->put(): Put an element to this table.