diff --git a/vnr/hashutil/hashstr.h b/vnr/hashutil/hashstr.h deleted file mode 100644 index fb13101..0000000 --- a/vnr/hashutil/hashstr.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef HASHSTR_H -#define HASHSTR_H - -// hashstr.h -// 8/1/2011 -// See: http://www.cse.yorku.ca/~oz/hash.html - -#include "hashutil/hashutil.h" -#include - -HASHUTIL_BEGIN_NAMESPACE - -enum : uint64_t { djb2_hash0 = 5381 }; - -/// djb2: h = h*33 + c -template -inline uint64_t djb2(const charT *str, uint64_t hash = djb2_hash0) -{ - charT c; - while ((c = *str++)) - hash = ((hash << 5) + hash) + c; // hash * 33 + c - return hash; -} - -/// n: length -template -inline uint64_t djb2_n(const charT *str, size_t len, uint64_t hash = djb2_hash0) -{ - while (len--) - hash = ((hash << 5) + hash) + (*str++); // hash * 33 + c - return hash; -} - -/// sdbm: hash(i) = hash(i - 1) * 65599 + str[i]; -template -inline uint64_t sdbm(const charT *str, uint64_t hash = 0) -{ - charT c; - while ((c = *str++)) - hash = c + (hash << 6) + (hash << 16) - hash; - return hash; -} - -template -inline uint64_t loselose(const charT *str, uint64_t hash = 0) -{ - charT c; - while ((c = *str++)) - hash += c; - return hash; -} - -HASHUTIL_END_NAMESPACE - -#endif // HASHSTR_H diff --git a/vnr/hashutil/hashutil.h b/vnr/hashutil/hashutil.h deleted file mode 100644 index 74b8597..0000000 --- a/vnr/hashutil/hashutil.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef HASHUTIL_H -#define HASHUTIL_H - -// hashutil.h -// 6/16/2015 jichi - -// Redefine HASHUTIL_BEGIN_NAMESPACE/HASHUTIL_END_NAMESPACE if need custom namespace -#ifndef HASHUTIL_BEGIN_NAMESPACE -# define HASHUTIL_BEGIN_NAMESPACE namespace hashutil { -#endif -#ifndef HASHUTIL_END_NAMESPACE -# define HASHUTIL_END_NAMESPACE } // namespace hashutil -#endif - -#endif // HASHUTIL_H diff --git a/vnr/vnrhook/CMakeLists.txt b/vnr/vnrhook/CMakeLists.txt index 1967b45..b21d902 100644 --- a/vnr/vnrhook/CMakeLists.txt +++ b/vnr/vnrhook/CMakeLists.txt @@ -52,8 +52,6 @@ set(vnrhook_src ${PROJECT_SOURCE_DIR}/cpputil/cpptype.h ${PROJECT_SOURCE_DIR}/cpputil/cppunicode.h ${PROJECT_SOURCE_DIR}/disasm/disasm.cc - ${PROJECT_SOURCE_DIR}/hashutil/hashstr.h - ${PROJECT_SOURCE_DIR}/hashutil/hashutil.h ${PROJECT_SOURCE_DIR}/memdbg/memdbg.h ${PROJECT_SOURCE_DIR}/memdbg/memsearch.cc ${PROJECT_SOURCE_DIR}/memdbg/memsearch.h diff --git a/vnr/vnrhook/src/engine/engine.cc b/vnr/vnrhook/src/engine/engine.cc index 3c1b27f..c41b2f9 100644 --- a/vnr/vnrhook/src/engine/engine.cc +++ b/vnr/vnrhook/src/engine/engine.cc @@ -19,7 +19,6 @@ #include "memdbg/memsearch.h" #include "ntinspect/ntinspect.h" #include "disasm/disasm.h" -#include "hashutil/hashstr.h" #include "cpputil/cppcstring.h" #include "ccutil/ccmacro.h" #include "mono/monoobject.h" @@ -27,7 +26,6 @@ #include #include -#define hashstr hashutil::djb2 // jichi 7/6/2014: read esp_base #define retof(esp_base) *(DWORD *)(esp_base) // return address