diff --git a/src/listconf.c b/src/listconf.c index 2ed40a2..a433118 100644 --- a/src/listconf.c +++ b/src/listconf.c @@ -70,8 +70,7 @@ static void listconf_list_options() puts("formats, format-details, format-all-details, format-methods[:WHICH],"); // With "opencl-devices, cuda-devices, " added, // the resulting line will get too long - // printf("sections, parameters:SECTION, list-data:SECTION, "); - puts("sections, parameters:SECTION, list-data:SECTION,"); + puts("format-tests, sections, parameters:SECTION, list-data:SECTION,"); #ifdef HAVE_OPENCL printf("opencl-devices, "); #endif @@ -578,6 +577,53 @@ void listconf_parse_late(void) } while ((format = format->next)); exit(0); } + if (!strncasecmp(options.listconf, "format-tests", 12)) { + struct fmt_main *format; + format = fmt_list; + do { + int ntests = 0; + + /* + * fmt_init() and fmt_done() required for --encoding= + * support, because some formats (like Raw-MD5u) + * change their tests[] depending on the encoding. + * + * Without fmt_init() and fmt_done(), only dynamic + * formats will report different tests for + * --encoding=ansi and --encoding=utf-8. + * + * But with fmt_init() and fmt_done(), I get an error + * for --list=format-tests --format=phpass (or anything + * that includes phpass, e.g. --form=cpu or --form=ph*): + * + * Error, trying to link to $dynamic_17$ using + * ciphertext=$dynamic_17$jgypwqm.JsMssPLiS8YQ00$9aaaaaSXB + * FAILED + * + */ + // fmt_init(format); // FIXME + + if(format->params.tests) { + while (format->params.tests[ntests].ciphertext) { + /* + * This should produce useful output for most + * formats. + * scrypt is the only exception, due to one + * test with tabs and new lines in ciphertext + * and password. + */ + printf("%s\t%d\t%s\t%s\n", + format->params.label, ntests, + format->params.tests[ntests].ciphertext, + format->params.tests[ntests].plaintext); + ntests++; + } + } + // fmt_done(format); // FIXME + + } while ((format = format->next)); + exit(0); + } /* * Other --list=help:WHAT are processed in listconf_parse_early(), but * these require a valid config: