-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathexample.cpp
More file actions
19 lines (17 loc) · 744 Bytes
/
example.cpp
File metadata and controls
19 lines (17 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "hashfunctions.h"
#include "ZRandom.h"
// compile me with gcc : g++ -o example example.cpp
int main(int params, char ** args) {
unsigned int some32bitstring[3] = {32321,32323,32132132}; // string should not end with zero, append a 1 if you must
// construct a random buffer, you can do this once
uint N = 128; // limit on the length of strings
vector<uint64>randombuffer64(N+2);
ZRandom zr;
for(uint k = 0;k<=N+2;++k)
randombuffer64[k] =zr.getValue() & (static_cast<uint64>(zr.getValue())<<32 ) ;
// we construct the hash function
StrongMultilinear sm(randombuffer64);
unsigned int * startpointer = &(some32bitstring[0]);
unsigned int * endpointer = startpointer+3;
uint hashvalue = sm.hash(startpointer,endpointer);
}