file hashing (not complete)

This commit is contained in:
2025-10-27 17:31:41 +02:00
parent 24c4e75943
commit 619d48d8c9
3 changed files with 375 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
/* Murmur3 example: hash the first command line argument. */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "murmur3.h"
int main(int argc, char **argv) {
uint32_t hash[4]; /* Output for the hash */
uint32_t seed = 420; /* Seed value for hash */
if (argc != 2) {
printf("usage: %s \"string to hash\"\n", argv[0]);
exit(1);
}
printf("Input: \"%s\"\n", argv[1]);
MurmurHash3_x86_32(argv[1], strlen(argv[1]), seed, hash);
printf("x86_32: %08x\n", hash[0]);
MurmurHash3_x86_128(argv[1], strlen(argv[1]), seed, hash);
printf("x86_128: %08x %08x %08x %08x\n",
hash[0], hash[1], hash[2], hash[3]);
MurmurHash3_x64_128(argv[1], strlen(argv[1]), seed, hash);
printf("x64_128: %08x %08x %08x %08x\n",
hash[0], hash[1], hash[2], hash[3]);
return 0;
}