Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 17 Apr 2015 17:01:04 +0800
From: Kai Zhao <>
Subject: Re: Advice on proposal: John the Ripper jumbo robustness

Note: compile without asan and afl

$ ./configure
$ make
$ echo garbage >
$ time ../john --format=7z
No password hashes loaded (see FAQ)

real    0m0.041s
user   0m0.038s
sys     0m0.004s

Calculate the invoked times and execution time of each function by gprof,
attachment is the output file.

The cfg_get_section() function occupies the most of time. This is why
it will get 7x speed-up when the john.conf is simple, such as "[Options]".

It is interesting why the cfg_get_section() is called 16080 times. Most of
the call is from the dynamic_IS_VALID() which is called 10000 times.

We can optimize the dynamic_Register_formats() function which invokes
10000 times of dynamic_IS_VALID(). Below is part of the code:

int dynamic_Register_formats(struct fmt_main **ptr)
    for (count = i = 0; i < 5000; ++i) {
        if (dynamic_IS_VALID(i, 1) == 1)
    // Ok, now we know how many formats we have.  Load them
    pFmts = mem_alloc_tiny(sizeof(pFmts[0])*count, MEM_ALIGN_WORD);
    for (idx = i = 0; i < 5000; ++i) {
        if (dynamic_IS_VALID(i, 1) == 1) {
            if (LoadOneFormat(i, &pFmts[idx]) == 0)

The dynamic_Register_formats() function invokes 10000 times of
cfg_get_section(), and every time cfg_get_section() tries to find the
section from begin to the end which has lots of sections in current

An way to optimize the dynamic_Register_formats() function is to
traverse all the sections and generates the result (whether valid) for
every dynamic section. In this way, we will use little more memory but
we reduce the 10000 times call to 1 time call. I think it speeds the john
without change the config file and it is not only for fuzz testing.

Do you agree with me? I am going to implement this change.



Content of type "text/html" skipped

View attachment "log_gprof.txt" of type "text/plain" (39642 bytes)

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.