diff -urpN john-1.7.8-jumbo-6a/src/bench.c john-1.7.8-jumbo-6b/src/bench.c --- john-1.7.8-jumbo-6a/src/bench.c 2011-08-03 16:19:13.000000000 +0000 +++ john-1.7.8-jumbo-6b/src/bench.c 2011-09-09 15:50:56.375000000 +0000 @@ -114,6 +114,8 @@ char *benchmark_format(struct fmt_main * static void *binary = NULL; static int binary_size = 0; static char s_error[64]; + char *TmpPW[1024]; + int pw_mangled=0; char *where; struct fmt_tests *current; int cond; @@ -163,8 +165,29 @@ char *benchmark_format(struct fmt_main * if (format->params.benchmark_length > 0) { cond = (salts == 1) ? 1 : -1; salts = 1; - } else + } else { cond = 0; + if (format->params.benchmark_length < -950) { + /* smash the passwords */ + struct fmt_tests *current = format->params.tests; + int i=0; + pw_mangled = 1; + while (current->ciphertext) { + if (current->plaintext[0]) { + TmpPW[i] = str_alloc_copy(current->plaintext); + TmpPW[i][0] ^= 5; + current->plaintext = TmpPW[i++]; + } + ++current; + } + /* -1001 turns into -1 and -1000 turns into 0 , and -999 turns into 1 for benchmark length */ + format->params.benchmark_length += 1000; + if (format->params.benchmark_length > 0) { + cond = (salts == 1) ? 1 : -1; + salts = 1; + } + } + } bench_set_keys(format, current, cond); @@ -239,6 +262,21 @@ char *benchmark_format(struct fmt_main * for (index = 0; index < 2; index++) MEM_FREE(two_salts[index]); + /* unsmash the passwords */ + if (pw_mangled) { + struct fmt_tests *current = format->params.tests; + int i=0; + while (current->ciphertext) { + if (current->plaintext[0]) { + TmpPW[i][0] ^= 5; + current->plaintext = TmpPW[i++]; + } + ++current; + } + /* -1001 turns into -1 and -1000 turns into 0 , and -999 turns into 1 for benchmark length */ + format->params.benchmark_length -= 1000; + } + return event_abort ? "" : NULL; }