diff --git a/engine/String.cpp b/engine/String.cpp index e519f2d9..a81277e6 100644 --- a/engine/String.cpp +++ b/engine/String.cpp @@ -1350,12 +1350,11 @@ String String::uriUnescape(const char* str, int* errptr) return s; } -unsigned int String::hash(const char* value) +unsigned int String::hash(const char* value, unsigned int h) { if (!value) return 0; - unsigned int h = 0; // sdbm hash algorithm, hash(i) = hash(i-1) * 65599 + str[i] while (unsigned char c = (unsigned char) *value++) h = (h << 6) + (h << 16) - h + c; diff --git a/yateclass.h b/yateclass.h index 4f0e9112..bb8e9cdb 100644 --- a/yateclass.h +++ b/yateclass.h @@ -1994,9 +1994,10 @@ public: /** * Get the hash of an arbitrary string. * @param value C string to hash + * @param h Old hash value for incremental hashing * @return The hash of the string. */ - static unsigned int hash(const char* value); + static unsigned int hash(const char* value, unsigned int h = 0); /** * Clear the string and free the memory