openwall / openwall/john

Async transfers to host for multiple salts

Open
#4,033 42 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement RFC / discussion
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Here's an idea on how we can speed up some OpenCL formats when working with multiple salts:

crypt_all is passed a pointer to the current salt in the database. It can also access salt->next->salt for likely next call's salt (except in self-test, benchmark, and "single crack" modes). When salt->next is non-NULL, before starting (edit: or waiting for completion of) transfer of computed hashes from device to host crypt_all may set the next salt and invoke the kernel for that one (with the set of candidate passwords previously transferred to device). crypt_all will also skip kernel invocation for the current salt if it's already been invoked by the previous call and the salt was predicted correctly (e.g., set_salt may reset a flag to indicate occasional misprediction - which should never happen with usual cracking modes). That way, for most salts (for all but the first one in salts list) transfers from device to host will overlap in time with computation of hashes for next salt.

In order to allow for such overlapping, we need two (sets of) output buffers (both on device and on host), pointers to which will be swapped before each kernel invocation. The rest of the format's functions such as cmp_* and get_hash_* will read from the buffer that was used for the current salt (not the next salt).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the affected OpenCL formats and their crypt_all, set_salt, cmp_* and get_hash_* entry points; trace the current device-to-host transfers and salt ordering. Done means predicted salts can overlap hash computation with result transfers while the comparison and hash functions read the correct output buffer.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.