aboutsummaryrefslogtreecommitdiff
path: root/src/hash
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/djb2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hash/djb2.c b/src/hash/djb2.c
index 8949ca8..7ec39de 100644
--- a/src/hash/djb2.c
+++ b/src/hash/djb2.c
@@ -3,11 +3,11 @@
#include <stdio.h>
#include <stdint.h>
-uint64_t djb2(uint8_t* in, size_t len){
- uint64_t hash = 5381;
+uint32_t djb2(uint8_t* in, size_t len){
+ uint32_t hash = 5381;
for(int i = 0; i != len; i++){
- hash = ((hash << 5) + hash) + (uint64_t)*in;
+ hash = ((hash << 5) + hash) + (uint32_t)*in;
in++;
}
@@ -20,8 +20,8 @@ int l_djb2(lua_State* L){
char digest[64];
- uint64_t u = djb2(a, len);
- sprintf(digest,"%08lx",u);
+ uint32_t u = djb2(a, len);
+ sprintf(digest,"%08x",u);
lua_pushstring(L, digest);
return 1;
}