diff options
| author | ame <[email protected]> | 2024-04-05 22:15:55 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-04-05 22:15:55 -0500 |
| commit | 6dbb6dc2104237299cca414cd3a86256122e4abf (patch) | |
| tree | b91c803a9a3ed3b391166684f0ac940c44977f17 /src/hash/jenkins.c | |
| parent | f752ddb0353fb7b06bce742b64b6a72322b51827 (diff) | |
+ + final fixes
Diffstat (limited to 'src/hash/jenkins.c')
| -rw-r--r-- | src/hash/jenkins.c | 14 |
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); |
