diff options
| author | ame <[email protected]> | 2024-03-28 12:41:17 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-03-28 12:41:17 -0500 |
| commit | cb280d5d1816ddbe0587775def896ab9c237bc4f (patch) | |
| tree | fc3dcf74e40ade1ebeb8cbb270fe28f8ce7b63b5 /src/hash/fletcher.h | |
| parent | e8654eece8832495f7e1189a866340227082a5ec (diff) | |
more hashes fixed
Diffstat (limited to 'src/hash/fletcher.h')
| -rw-r--r-- | src/hash/fletcher.h | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/src/hash/fletcher.h b/src/hash/fletcher.h index c77bce4..d66692f 100644 --- a/src/hash/fletcher.h +++ b/src/hash/fletcher.h @@ -1,33 +1,44 @@ #include "../lua.h" #include <stdint.h> -/** - * calculates a fletcher hash of (len) bytes - * - * @param {uint8_t*} input bytes - * @param {size_t} input length - * @return {uint8_t} 8 bit hash -*/ -uint8_t i_fletcher8(uint8_t*,size_t); - -/** - * calculates a fletcher hash of (len) bytes - * - * @param {uint8_t*} input bytes - * @param {size_t} input length - * @return {uint16_t} 16 bit checksum -*/ -uint16_t i_fletcher16(uint8_t*,size_t); - -/** - * calculates a fletcher hash of (len) bytes - * - * @param {uint8_t*} input bytes - * @param {size_t} input length - * @return {uint32_t} 32 bit checksum -*/ -uint32_t i_fletcher32(uint8_t*,size_t); +struct fletcher8_hash { + uint8_t s1, s2; +}; + +struct fletcher16_hash { + uint16_t s1, s2; +}; + +struct fletcher32_hash { + uint32_t s1, s2; +}; + +uint8_t fletcher8(uint8_t*,size_t); +struct fletcher8_hash fletcher8_init(); +void fletcher8_update(uint8_t*, size_t, struct fletcher8_hash*); +uint8_t fletcher8_final(struct fletcher8_hash*); + +uint16_t fletcher16(uint8_t*,size_t); +struct fletcher16_hash fletcher16_init(); +void fletcher16_update(uint8_t*, size_t, struct fletcher16_hash*); +uint16_t fletcher16_final(struct fletcher16_hash*); + +uint32_t fletcher32(uint8_t*,size_t); +struct fletcher32_hash fletcher32_init(); +void fletcher32_update(uint8_t*, size_t, struct fletcher32_hash*); +uint32_t fletcher32_final(struct fletcher32_hash*); int l_fletcher32(lua_State*); +int l_fletcher32_init(lua_State*); +int l_fletcher32_update(lua_State*); +int l_fletcher32_final(lua_State*); + int l_fletcher16(lua_State*); +int l_fletcher16_init(lua_State*); +int l_fletcher16_update(lua_State*); +int l_fletcher16_final(lua_State*); + int l_fletcher8(lua_State*); +int l_fletcher8_init(lua_State*); +int l_fletcher8_update(lua_State*); +int l_fletcher8_final(lua_State*);
\ No newline at end of file |
