mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1136] Shared-code OpenCL auto-tune w/ GPU-side mask #711
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#711
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Mar 22, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1136
This is something we need to look into. Shouldn't this be pretty easy? If this run is indeed using a mask, just "use" it. If the mode in question doesn't implement it on GPU-side it will have no effect so we can do this (whatever "do this" means) anyway.
I see we are currently calling format's init() before mask_init(). That probably needs to be changed.
Once we have this in place, having benchmark test GPU-mask speed should be easy too.
@magnumripper commented on GitHub (Mar 22, 2015):
In #1131, @claudioandre said
Can we tune that at all? I though mask mode would pick the highest possible that does not exceed some upper limit. If mask is only made of ?d it will pick four of them on GPU side resulting in an "accelleration" of 10,000x. A mask consiting of ?a will only get two of them on GPU side, for 16,129x. A mask consisting of just ?l or ?u will get three of them, for 17,576x.
Maybe what you are saying is that mask_int_cand_target will set that thing I thought was "some upper limit"?
@ghost commented on GitHub (Mar 23, 2015):
Yes, I was talking about this limit. But some tests showed the gain is small and the possible damage isn't.
@sayan1an commented on GitHub (Mar 23, 2015):
some info on mask_int_cand_target- it is a target, not the actual number of candidates generated internally. Actual number of internal candidates generated could be higher or lower, depending on whichever is closer to the target. It is not necessary that we'd always select 4 placeholders; always a minimum number of placeholders that meets the target is chosen.
Since the target is used inside mask init to do the necessary setup of GPU and CPU part, you are not allowed to vary the target during benchmark sessions. If you do so, you'll have to invoke mask_init again!!
@ghost commented on GitHub (Mar 23, 2015):
@ghost commented on GitHub (Mar 23, 2015):
6a49ab7089@magnumripper commented on GitHub (Mar 23, 2015):
This is very appealing! It has several other good effects (eg. we can get rid of kludges for --list=format-details and things like that).
@magnumripper commented on GitHub (Mar 23, 2015):
I think the above allows us to do this with no change to the spec.
Apparently reset() is called once during self-test (with no db) and once right before a crack session starts (this time with a db). Your PoC implementation only auto-tunes when reset is called with db == NULL so this is probably fine and dandy already. I think we should do a similar change to raw-md4 right away.
@magnumripper commented on GitHub (Mar 23, 2015):
For a real crack run, we should auto-tune for GPU-mask only if a mask is given (and then of course with that very mask). For a benchmark-only run, I think we should use some standard mask. I'm not sure whether we should replace the normal figures with GPU-side-mask ones, or show both figures.
@ghost commented on GitHub (Mar 23, 2015):
Even if --skip-self-test is provided.
@magnumripper commented on GitHub (Mar 24, 2015):
ef4b3dbbdoes it to all OpenCL formats, bar DES, BF and mscash2 (they already did not auto-tune in init()). And kludges in listconf.c was removed.@magnumripper commented on GitHub (Mar 24, 2015):
Tried some quick'n'dirty hacks for GPU-mask auto-tune & benchmark.
The above will pick the default stacked mask
?w?d?d?d?d(from john.conf). But auto-tune failed (crashed) because it's not prepared to the change of the &count argument to crypt_all(). Something like this is a minimum (just keeps resetting the count variable so we don't feed next call with the returned value of last call)......this almost works, but not quite... The real fix is slightly more complicated - we'd want to use the changed
&countfor showing speeds.@magnumripper commented on GitHub (Mar 24, 2015):
M'kay, that mask_init() is too early, it will cause the self-test to fail. For this quick'n'dirty test I wanted self-test to run without mask, and benchmark with a mask. And putting it later, in
benchmark_format(), sort of works, but there seem to be more code (in that function) not handling the fact &count is changed...@magnumripper commented on GitHub (Mar 25, 2015):
This version auto-tunes correctly (except it does twice, first without mask, then with) but then segfaults
Notice how the second auto-tune shows much lower c/s (they should be multiplied with 10K so are actually higher) and longer durations, and ends up at 16K instead of 4M. Not yet sure why it segfaults.
@magnumripper commented on GitHub (Mar 25, 2015):
OK, for some reason there's no segfault if I supply the LWS. Same patch as above
@ghost commented on GitHub (Mar 25, 2015):
This is a side effect of init() called twice. Easy to fix, but notice that there are other inconvenient that has to be handled:
@magnumripper commented on GitHub (Mar 25, 2015):
I have some alternate code that works slightly better but it's just a PoC nevertheless. Anyway this is pretty cool, it quickly auto-tunes to good sizes for GPU-side mask. We need to decide what we really want to do. For example, maybe we actually want/need to actually self-test mask mode as opposed to just benchmarking it? At least when a mask is supplied.
@ghost commented on GitHub (Mar 25, 2015):
In fact, mask has to have a formal test. But, I prefer TS for this task. I like self-test, but I dislike when it becomes too complicated for a regular run.
Anyway, this is not hard to be implemented:
Or, much easier, parse a new global/parameter array set by each format (or the default NULL):
@magnumripper commented on GitHub (Mar 26, 2015):
The current tests struct is (few formats use the
*fields[10])So if we add a mask
I suppose syntax when using mask but not fields[10] would be something like (is this correct?)
...and formats not using it would need no change.
Anyway so with that test-vector, we'd just supply test-vectors with plaintexts that are incomplete unless you add that mask, right? So for "?w?l?l?l" we should change "epixoip" to "epix". Perhaps better is to introduce yet another field for a mask-plaintext
And supply both
@ghost commented on GitHub (Apr 1, 2015):
To be used for tune latter (notice, util is 80%):
@magnumripper commented on GitHub (Dec 3, 2015):
This is implemented. Not quite finished but we have other issues for it. A future issue will be "add GPU-side mask mode self-tests" btw.