-
Notifications
You must be signed in to change notification settings - Fork 4
/
StringHash.h
35 lines (31 loc) · 905 Bytes
/
StringHash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef __STRING_HASH__
#define __STRING_HASH__
#include <string>
using namespace std;
#define MAXTABLELEN 1024
//////////////////////////////////////////////////////////////////////////
typedef struct _HASHTABLE
{
long nHashA;
long nHashB;
bool bExists;
}HASHTABLE, *PHASHTABLE ;
class StringHash
{
public:
StringHash(const long nTableLength = MAXTABLELEN);
~StringHash(void);
private:
unsigned long cryptTable[0x500];
unsigned long m_tablelength;
HASHTABLE *m_HashIndexTable;
private:
void InitCryptTable();
unsigned long HashString(const string& lpszString, unsigned long dwHashType);
public:
bool Hash(string url);
unsigned long Hashed(string url);
HASHTABLE GetStringHashTable(unsigned long pos){ return m_HashIndexTable[pos]; }
unsigned long GetTableLength(void) { return m_tablelength; }
};
#endif