aboutsummaryrefslogtreecommitdiff
path: root/src/hash/jenkins.c
diff options
context:
space:
mode:
authorame <[email protected]>2024-04-05 22:15:55 -0500
committerame <[email protected]>2024-04-05 22:15:55 -0500
commitb8c10dac99316974d142c530356ad5cd8fdf9afa (patch)
treeb91c803a9a3ed3b391166684f0ac940c44977f17 /src/hash/jenkins.c
parent18657b5d226f5fe20ea049308b5078fd188ae96c (diff)
+ + final fixes
Diffstat (limited to 'src/hash/jenkins.c')
-rw-r--r--src/hash/jenkins.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/hash/jenkins.c b/src/hash/jenkins.c
index 6daf831..dc96ff6 100644
--- a/src/hash/jenkins.c
+++ b/src/hash/jenkins.c
@@ -16,11 +16,12 @@ void jenkins_oaat_update(uint8_t* in, size_t len, struct jenkins_oaat_hash* hash
}
uint32_t jenkins_oaat_final(struct jenkins_oaat_hash* hash){
- hash->hash += hash->hash << 3;
- hash->hash ^= hash->hash >> 11;
- hash->hash += hash->hash << 15;
+ uint32_t h = hash->hash;
+ h += h << 3;
+ h ^= h >> 11;
+ h += h << 15;
- return hash->hash;
+ return h;
}
@@ -33,10 +34,7 @@ uint32_t jenkins_oaat(uint8_t* in, size_t len){
lua_common_hash_init_update(jenkins_oaat, oaat);
int l_oaat_final(lua_State* L){
- lua_pushstring(L, "ud");
- lua_gettable(L, 1);
-
- struct jenkins_oaat_hash* a = (struct jenkins_oaat_hash*)lua_touserdata(L, -1);
+ struct jenkins_oaat_hash* a = (struct jenkins_oaat_hash*)lua_touserdata(L, 1);
uint32_t u = jenkins_oaat_final(a);
char digest[64];
sprintf(digest,"%04x",u);