defuse / crackstation-hashdb

CrackStation.net's Lookup Table Implementation.
GNU General Public License v3.0
365 stars 107 forks source link

Compiling of sortindex.c gives warnings, doesn't seem to work #2

Open vliegelientje opened 9 years ago

vliegelientje commented 9 years ago

When compiling sortidx.c some warnings are being displayed. The executable hangs, no output is displayed...

$ make
gcc -O2 sortidx.c -o sortidx
sortidx.c: In function ‘main’:
sortidx.c:69:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat=]
         printf("Invalid buffer size (%d).\n", bufsize);
         ^
sortidx.c:88:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat=]
         printf("Cannot allocate buffer (%d bytes).\n", bufsize);
         ^
sortidx.c: In function ‘freadIndexEntryAt’:
sortidx.c:325:10: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
     fread(out->hash, sizeof(unsigned char), INDEX_HASH_WIDTH, file);
          ^
sortidx.c:326:10: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
     fread(out->position, sizeof(unsigned char), INDEX_POSITION_WIDTH, file);
defuse commented 9 years ago

Sorry this is shitty code. 50b0ecad714873a58fd8b52b2886cc772b5056f7 fixes the format string issue.

If you're sorting a big index, it will appear to hang while it's sorting (possibly for days or weeks if it's REALLY big). Giving it more memory with -r helps bring more of the sort into RAM and speeds it up a lot. If it hangs on small files that's definitely a problem.