3 ms·
Oh, this switch https://github.com/hashcat/hashcat/blob/master/src/engine.c#L29 https://github.com/hashcat/hashcat/blob/master/src/engine.c#...
by devnikor 11y ago
Oh, this switch
https://github.com/hashcat/hashcat/blob/master/src/engine.c#L29 https://github.com/hashcat/hashcat/blob/master/src/engine.c#...
- meowface 11y agoWhat is the purpose of this, exactly? I assume it has to be some sort of performance optimization. Hashcat probably isn't the best model for clean code, since its primary goal is to squeeze every drop of performance it can get.
- pjc50 11y agoIt's a hardcoded map of int to string. That's a fairly reasonable way of doing it in vanilla C. How efficient it actually is is down to your compiler. And some compilers impose maximum limits on the size of `case` statements.. An alternative would be a precomputed hash table, similar to what `gperf` does. Requires more work in the build system though.
- fit2rule 11y agoBesides the curious length of the switch, I'm not seeing anything particularly 'bad' about this code .. sort of left wondering what the big deal is? This is perfectly reasonable code.
- deleted 11y ago[deleted]
- michael_h 11y agoIt doesn't look too terrible, but it looks like it is optimized for speed, not maintainability. I'm assuming that's why there is a lot of repeated code (instead of putting it into a function/loop). The comments are a little spartan.