Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 18 Jul 2012 13:52:03 +0400
From: Solar Designer <>
Subject: int crypt_all(count, salt)

myrice, all -

I've revised crypt_all() to be as follows:

/* Computes the ciphertexts for given salt and plaintexts.
 * For implementation reasons, this may happen to always compute at least
 * min_keys_per_crypt ciphertexts even if the requested count is lower,
 * although it is preferable for implementations to obey the count whenever
 * practical and also for callers not to call crypt_all() with fewer than
 * min_keys_per_crypt keys whenever practical.
 * Returns the last output index for which there might be a match (against the
 * supplied salt's hashes) plus 1.  A return value of zero indicates no match.
 * If an implementation does not use the salt parameter or if salt is NULL
 * (as it may be during self-test and benchmark), the return value must always
 * be exactly count. */
	int (*crypt_all)(int count, struct db_salt *salt);

This is an intermediate step before even further changes to it.  (The
next change to crypt_all() will likely be to make "int *count" - that
is, let crypt_all() modify the count when it computes more hashes than
there were keys, due to set_mask().  Yes, set_mask() is to be introduced
at the same time with that change.)

Attached to this message are 3 patches:

john- - makes the crypt_all() declaration
and semantics changes to match the description above, patch relative to
john- that I posted before.

john- - makes use of the above changes to speed up LM
hash cracking in OpenMP-enabled builds.  This is a quick and dirty
implementation not taking full advantage of the crypt_all() changes yet,
but it does illustrate how the interface may be used.  This implements
initial hash comparisons within the same parallel region that computes
the hashes, and by the same threads that computed the hashes (so it
can't happen that one thread computed a hash, but another does the
comparison, which would be slower).  I've actually measured an almost 2x
speedup in a certain OpenMP-enabled build running against 10k hashes.
For the sake of simplicity, I am using the existing salt->index() hash
function, although this involves converting from thread offset + index
in thread to global index and back.  A "standalone" implementation (like
one running on GPU) would implement a hash function of its own and would
access its own bitmap, hash table, etc.  I primarily had myrice's
project in mind when working on this example.  In fact, I wouldn't be
working on it right now otherwise.

john- is the same as above, but relative to
clean as found in CVS.

myrice - if you'd like to experiment with these new interfaces on
bleeding codebase (so that you can use them with a GPU format), you may
move all *_fmt_plug.c files out of the tree so that you have fewer
formats to modify to use the new conventions (or disable manually in
Makefile and john.c).  I actually recommend that you do this.  You may
also proceed to experiment with your own formats interface changes in
a similar way (and propose successful ones in here).



View attachment "john-" of type "text/plain" (14411 bytes)

View attachment "john-" of type "text/plain" (1701 bytes)

View attachment "john-" of type "text/plain" (24320 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ