|
16 | 16 | #include <sys/mman.h> |
17 | 17 |
|
18 | 18 | static void printusage(char *command) { |
19 | | - printf(" Try %s filter.bin 7C4A8D09CA3762AF \n", command); |
| 19 | + printf(" Try %s filter.bin 7C4A8D09CA3762AF (use 16-hex-character keys)\n", command); |
20 | 20 | ; |
21 | 21 | printf("Use the -s if you want to provide a string to be hashed (SHA1).\n"); |
22 | 22 | } |
@@ -59,10 +59,10 @@ int main(int argc, char **argv) { |
59 | 59 | hexval = ((uint64_t)digest[0] << 32) | digest[1]; |
60 | 60 | } else { |
61 | 61 | const char *hashhex = argv[optind + 1]; |
62 | | - if (strlen(hashhex) < 16) { |
63 | | - printf("bad hex. length is %zu \n", strlen(hashhex)); |
| 62 | + if (strlen(hashhex) != 16) { |
| 63 | + printf("bad hex. length is %zu, 16 hexadecimal characters expected.\n", strlen(hashhex)); |
64 | 64 | printusage(argv[0]); |
65 | | - return -1; |
| 65 | + return EXIT_FAILURE; |
66 | 66 | } |
67 | 67 | uint64_t x1 = hex_to_u32_nocheck((const uint8_t *)hashhex); |
68 | 68 | uint64_t x2 = hex_to_u32_nocheck((const uint8_t *)hashhex + 4); |
@@ -122,6 +122,8 @@ int main(int argc, char **argv) { |
122 | 122 | binfilter.Seed = seed; |
123 | 123 | isok &= |
124 | 124 | fread(&binfilter.SegmentLength, sizeof(binfilter.SegmentLength), 1, fp); |
| 125 | + isok &= |
| 126 | + fread(&binfilter.SegmentLengthMask, sizeof(binfilter.SegmentLengthMask), 1, fp); |
125 | 127 | isok &= |
126 | 128 | fread(&binfilter.SegmentCount, sizeof(binfilter.SegmentCount), 1, fp); |
127 | 129 | isok &= fread(&binfilter.SegmentCountLength, |
|
0 commit comments