Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 26 Mar 2012 10:05:47 -0500
From: "jfoug" <>
To: <>
Subject: RE: get_salt return question

>What happens to the return address from get_salt? Does JtR internally
>copies the data (upto SALT_SIZE) and and later gives it to set_salt?

Yes.  I believe JtR allocates a buffer, and copies it (based upon the
format's salt_size, which is usually set by SALT_SIZE being assigned to it).

The nice thing about doing the expensive work in get_salt, is that you do it
one time.  So all computation/allocation, etc that 'can' be done upfront,
should be done there.

Within the processing loop, it is sort of like this:

key_index = 0;
while (pw=getword()) {
   if (set_key(pw,key_index++) is max keys) {
      while (next_salt = walk_salt_list()) {
         if (cmp_all()) { /* search for exact match */ }
	key_index = 0;

As you can see above, if you put that expensive logic down in the set_salt()
function, then you have to compute that for each salt, for each set of
passwords.  So if you work on one PW at a time (I think PDF does this), then
you perform the salt work #salts * #passwords.  If done in get_salt then you
only do the salt work #salts times.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.