From 8e00fec33cda4d7d77fa63be290c77a06832708e Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Sat, 7 Jan 2023 18:16:18 +0100 Subject: [PATCH] PJW hash: add credits --- 2022/include/pjwhash-inline.h | 2 +- 2022/include/pjwhash.h | 12 +++++++++++- 2022/libsrc/pjwhash.c | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/2022/include/pjwhash-inline.h b/2022/include/pjwhash-inline.h index 81dabb7..ed5e8f5 100644 --- a/2022/include/pjwhash-inline.h +++ b/2022/include/pjwhash-inline.h @@ -34,7 +34,7 @@ * * Return: the PJW hash. */ -_pjw_inline unsigned int pjwhash(const void* key, uint length) +_pjw_inline uint pjwhash(const void* key, uint length) { uint hash = 0, high; const u8 *k = key; diff --git a/2022/include/pjwhash.h b/2022/include/pjwhash.h index 4a33d5a..19b0d76 100644 --- a/2022/include/pjwhash.h +++ b/2022/include/pjwhash.h @@ -15,6 +15,16 @@ #include "bits.h" -extern unsigned int pjwhash (const void* key, uint length) +/** + * unsigned int pjwhash - PJW hash function + * @key: the key address. + * @length: the length of key. + * + * This hash was created by Peter Jay Weinberger (AT&T Bell Labs): + * https://en.wikipedia.org/wiki/PJW_hash_function + * + * Return: the PJW hash. + */ +extern uint pjwhash (const void* key, uint length); #endif /* _PJWHASH_H */ diff --git a/2022/libsrc/pjwhash.c b/2022/libsrc/pjwhash.c index e8fb150..554f9e3 100644 --- a/2022/libsrc/pjwhash.c +++ b/2022/libsrc/pjwhash.c @@ -13,4 +13,8 @@ #define _pjw_inline extern +//#include "bits.h" +//extern unsigned int pjwhash (const void* key, uint length); + +#include "pjwhash.h" #include "pjwhash-inline.h"