"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/tests-hashing.c" between
n2n-3.0.tar.gz and n2n-3.1.1.tar.gz

About: n2n is a layer-two peer-to-peer virtual private network (VPN) which allows bypassing intermediate firewalls.
Pre-release.

tests-hashing.c  (n2n-3.0):tests-hashing.c  (n2n-3.1.1)
/* /*
* (C) 2007-21 - ntop.org and contributors * (C) 2007-22 - ntop.org and contributors
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 43 skipping to change at line 43
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 , 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
}; };
void test_pearson (void *buf, unsigned int bufsize) { void test_pearson_16 (void *buf, unsigned int bufsize) {
char *test_name = "pearson"; char *test_name = "pearson_hash_16";
uint16_t hash = pearson_hash_16(buf, bufsize);
printf("%s: output = 0x%" PRIx16 "\n", test_name, hash);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_32 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_32";
uint32_t hash = pearson_hash_32(buf, bufsize);
printf("%s: output = 0x%" PRIx32 "\n", test_name, hash);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_64 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_64";
uint64_t hash = pearson_hash_64(buf, bufsize); uint64_t hash = pearson_hash_64(buf, bufsize);
printf("%s: output = 0x%" PRIx64 "\n", test_name, hash); printf("%s: output = 0x%" PRIx64 "\n", test_name, hash);
fprintf(stderr, "%s: tested\n", test_name); fprintf(stderr, "%s: tested\n", test_name);
printf("\n"); printf("\n");
} }
void test_pearson_128 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_128";
uint8_t hash[16];
pearson_hash_128(hash, buf, bufsize);
printf("%s: output:\n", test_name);
fhexdump(0, hash, sizeof(hash), stdout);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
void test_pearson_256 (void *buf, unsigned int bufsize) {
char *test_name = "pearson_hash_256";
uint8_t hash[32];
pearson_hash_256(hash, buf, bufsize);
printf("%s: output:\n", test_name);
fhexdump(0, hash, sizeof(hash), stdout);
fprintf(stderr, "%s: tested\n", test_name);
printf("\n");
}
int main (int argc, char * argv[]) { int main (int argc, char * argv[]) {
pearson_hash_init(); pearson_hash_init();
char *test_name = "environment"; char *test_name = "environment";
printf("%s: input size = 0x%" PRIx64 "\n", test_name, sizeof(PKT_CONTENT)); printf("%s: input size = 0x%" PRIx64 "\n", test_name, sizeof(PKT_CONTENT));
fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout); fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout);
printf("\n"); printf("\n");
test_pearson(PKT_CONTENT, sizeof(PKT_CONTENT)); test_pearson_256(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_128(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_64(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_32(PKT_CONTENT, sizeof(PKT_CONTENT));
test_pearson_16(PKT_CONTENT, sizeof(PKT_CONTENT));
return 0; return 0;
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 56 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)