Skip to content

Commit f75cda0

Browse files
committed
Merge branch 'master' of https://github.com/xtaci/algorithms
2 parents d6c3051 + 7b1385d commit f75cda0

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/universal_hash_demo.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
#include <string.h>
1313
#include <time.h>
1414

15-
#include "sha1.h"
16-
1715
#include "universal_hash.h"
18-
#define TEST "this is a string"
1916

2017
using namespace alg;
2118
int main(void)
@@ -29,26 +26,8 @@ int main(void)
2926
int i;
3027
for (i = 0; i < MAXELEMENT; i++)
3128
{
32-
int key = rand()%100;
33-
34-
printf("hashing %d --> %d\n", key, uhash_integer(&params, key));
35-
}
36-
37-
SHA1Context sha;
38-
39-
sha1_reset(&sha);
40-
sha1_input(&sha, (const unsigned char *) TEST, strlen(TEST));
41-
42-
if (sha1_final(&sha))
43-
{
44-
int i;
45-
for(i = 0; i < 5 ; i++)
46-
{
47-
printf("%x", sha.digest[i]);
48-
}
29+
printf("hashing %d --> %d\n", i, uhash_integer(&params, i));
4930
}
50-
51-
printf("\n -- hashing big int into %d\n", uhash_bigint(&params, sha.digest,5));
5231

53-
return 0;
32+
printf("prime %d\n", params.prime);
5433
}

0 commit comments

Comments
 (0)