Skip to content

Commit

Permalink
Add tests formatted in exactly the same way as the hashes in john.pot
Browse files Browse the repository at this point in the history
May be I'm too paranoid, but I wanted to make sure each format
"understands" the hash format it uses for john.pot
  • Loading branch information
frank-dittrich committed Dec 31, 2014
1 parent ca62969 commit 546a203
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 1 deletion.
6 changes: 6 additions & 0 deletions run/dynamic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ Func=DynamicFunc__crypt_md5_in2_to_out1
Test=$dynamic_1015$1d586cc8d137e5f1733f234d224393e8$HEX$f063f05d:openwall:postgres
Test=$dynamic_1015$1c4e11fb51835c3bbe9851ec91ec1375$HEX$c31803a2:password:postgres
Test=$dynamic_1015$bf2a64f35feba7bf1b633d60393c1356$HEX$684697c8:openwall:postgres
# repeat one test in the format that is used in john.pot
Test=$dynamic_1015$1d586cc8d137e5f1733f234d224393e8$HEX$f063f05d242455706f737467726573:openwall
TestM=$dynamic_1015$c99b3494687ed9895d4ffca184a9daf5$M6krNt:1234567890123456789012345678901:usrx
TestF=$dynamic_1015$5618a66e934dfef13cae2d06d71bdf75$usrwxT:12345678901234567890123456789012345678901234567890123456:01234

Expand All @@ -459,6 +461,8 @@ Func=DynamicFunc__append_keys
Func=DynamicFunc__append_salt
Func=DynamicFunc__MD5_crypt_input1_to_output1_FINAL
Test=$dynamic_1016$08e3ded271f83affc8f127dae3cb5bed$HEX$e30003fa000100000001000000000000000000000000000000000000000000000000000000000000d7dd1060ee06bec2:secret
# repeat that hash in exactly the same form that is used in john.pot
Test=$dynamic_1016$08e3ded271f83affc8f127dae3cb5bed$HEX$48455824653330303033666130303031303030303030303130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303064376464313036306565303662656332:secret

[List.Generic:dynamic_1018]
Expression=md5(sha1(sha1($pass)))
Expand Down Expand Up @@ -755,6 +759,8 @@ Func=DynamicFunc__crypt
# when we get them. Only the first 16 bytes is used in hash compare within JtR
Test=$dynamic_1401$27f6a9d892475e6ce0391de8d2d893f700000000:password:username
Test=$dynamic_1401$27f6a9d892475e6ce0391de8d2d893f700000000$$Uusername:password
# repeat that hash in exactly the same form that is used in john.pot
Test=$dynamic_1401$27f6a9d892475e6ce0391de8d2d893f700000000$HEX$2455757365726e616d65:password

# In Redmine, the hashed password is stored in the following form,
# SHA1(salt + SHA1(password))
Expand Down
2 changes: 2 additions & 0 deletions src/NETLM_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ static struct fmt_tests tests[] = {
{"", "HIYAGERGE", {"User", "", "", "16A7FDFE0CA109B937BFFB041F0E5B2D8B94A97D3FCA1A18", "ntlm-hash", "1122334455667788"} },
{"", "MEDUSAFGDUMP12", {"User", "", "", "B3A1B87DBBD4DF3CFA296198DD390C2F4E2E93C5C07B1D8B", "ntlm-hash", "1122334455667788"} },
{"", "CORY21", {"User", "", "", "0836F085B124F33895875FB1951905DD2F85252CC731BB25", "ntlm-hash", "1122334455667788"} },
// repeat in exactly the same format that is used in john.pot (lower case hex)
{"$NETLM$1122334455667788$0836f085b124f33895875fb1951905dd2f85252cc731bb25", "CORY21"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/NETLMv2_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static struct fmt_tests tests[] = {
{"", "1337adminPASS", {"FOODOM\\Administrator", "", "", "1122334455667788", "6F64C5C1E35F68DD80388C0F00F34406", "F0F3FF27037AA69F"} },
{"$NETLMv2$ADMINISTRATORFOODOM$1122334455667788$6F64C5C1E35F68DD80388C0F00F34406$F0F3FF27037AA69F", "1337adminPASS"},
{"$NETLMv2$USER1$1122334455667788$B1D163EA5881504F3963DC50FCDC26C1$EB4D9E8138149E20", "foobar"},
// repeat in exactly the same format that is used in john.pot (lower case hex)
{"$NETLMv2$USER1$1122334455667788$b1d163ea5881504f3963dc50fcdc26c1$eb4d9e8138149e20", "foobar"},
{"$NETLMv2$ATEST$1122334455667788$83B59F1536D3321DBF1FAEC14ADB1675$A1E7281FE8C10E53", "SomeFancyP4$$w0rdHere"},
{"", "1337adminPASS", {"administrator", "", "FOODOM", "1122334455667788", "6F64C5C1E35F68DD80388C0F00F34406", "F0F3FF27037AA69F"} },
{"", "foobar", {"user1", "", "", "1122334455667788", "B1D163EA5881504F3963DC50FCDC26C1", "EB4D9E8138149E20"} },
Expand Down
2 changes: 2 additions & 0 deletions src/NETNTLMv2_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static struct fmt_tests tests[] = {
{"$NETNTLMv2$NTLMV2TESTWORKGROUP$1122334455667788$07659A550D5E9D02996DFD95C87EC1D5$0101000000000000006CF6385B74CA01B3610B02D99732DD000000000200120057004F0052004B00470052004F00550050000100200044004100540041002E00420049004E0043002D0053004500430055005200490000000000", "password"},
{"$NETNTLMv2$TESTUSERW2K3ADWIN7$1122334455667788$989B96DC6EAB529F72FCBA852C0D5719$01010000000000002EC51CEC91AACA0124576A744F198BDD000000000200120057004F0052004B00470052004F00550050000000000000000000", "testpass"},
{"$NETNTLMv2$USERW2K3ADWIN7$1122334455667788$5BD1F32D8AFB4FB0DD0B77D7DE2FF7A9$0101000000000000309F56FE91AACA011B66A7051FA48148000000000200120057004F0052004B00470052004F00550050000000000000000000", "password"},
// repeat in exactly the same form that is used in john.pot
{"$NETNTLMv2$USERW2K3ADWIN7$1122334455667788$5bd1f32d8afb4fb0dd0b77d7de2ff7a9$0101000000000000309f56fe91aaca011b66a7051fa48148000000000200120057004f0052004b00470052004f00550050000000000000000000", "password"},
{"$NETNTLMv2$USER1W2K3ADWIN7$1122334455667788$027EF88334DAA460144BDB678D4F988D$010100000000000092809B1192AACA01E01B519CB0248776000000000200120057004F0052004B00470052004F00550050000000000000000000", "SomeLongPassword1BlahBlah"},
{"$NETNTLMv2$TEST_USERW2K3ADWIN7$1122334455667788$A06EC5ED9F6DAFDCA90E316AF415BA71$010100000000000036D3A13292AACA01D2CD95757A0836F9000000000200120057004F0052004B00470052004F00550050000000000000000000", "TestUser's Password"},
{"$NETNTLMv2$USER1Domain$1122334455667788$5E4AB1BF243DCA304A00ADEF78DC38DF$0101000000000000BB50305495AACA01338BC7B090A62856000000000200120057004F0052004B00470052004F00550050000000000000000000", "password"},
Expand Down
3 changes: 2 additions & 1 deletion src/NETSPLITLM_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static struct fmt_tests tests[] = {

{"", "G3RG3P0", {"domain\\username", "", "", "6E1EC36D3417CE9E09A4424309F116C4C991948DAEB4ADAD", "", "1122334455667788"} },
{"", "ZEEEZ@1", {"domain\\username", "", "", "1354FD5ABF3B627B8B49587B8F2BBA0F9F6C5E420824E0A2", "", "1122334455667788"} },

// repeat last hash in exactly the same format that is used in john.pot
{"$NETHALFLM$1122334455667788$1354fd5abf3b627b8b49587b8f2bba0f9f6c5e420824e0a2", "ZEEEZ@1"},
{NULL}
};

Expand Down
4 changes: 4 additions & 0 deletions src/PHPS_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ static struct fmt_tests phps_tests[] = {
{"$PHPS$433925$5d756853cd63acee76e6dcd6d3728447", "welcome"},
{"$PHPS$73616c$aba22b2ceb7c841473c03962b145feb3", "password"},
{"$PHPS$247824$ad14afbbf0e16d4ad8c8985263a3d051","test"}, // salt is $x$ (I want to test that a $ works)
// repeat hashes in the same format that is used in john.pot
{"$dynamic_6$5d756853cd63acee76e6dcd6d3728447$C9%", "welcome"},
{"$dynamic_6$aba22b2ceb7c841473c03962b145feb3$sal", "password"},
{"$dynamic_6$ad14afbbf0e16d4ad8c8985263a3d051$HEX$247824", "test"},
{NULL}
};

Expand Down
12 changes: 12 additions & 0 deletions src/dynamic_preloads.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ static struct fmt_tests _Preloads_15[] =
{"$dynamic_15$6093d5cb3e2f99d9110eb9c4bbca5f8c$aaaSXB","test1", {"joeblow"} },
{"$dynamic_15$6a2dc4a6637bc5c2488f27faeead8720$123456","thatsworking", {"admin"} },
{"$dynamic_15$63aea4b8fe491df8545cc0099ac668d4$5555hh","test3", {"ralph"} },
// at least one hash exactly like it gets stored in john.pot
{"$dynamic_15$6093d5cb3e2f99d9110eb9c4bbca5f8c$HEX$6161615358422424556a6f65626c6f77","test1"},
#ifdef DEBUG
{"$dynamic_15$a2609e968a7124a8ac299c5f03341b85$123456789012$$Ubarney", "1234567890123456789012345678901234567890123456789012345"},
#ifndef MMX_COEF
Expand Down Expand Up @@ -654,6 +656,8 @@ static struct fmt_tests _Preloads_16[] =
{"$dynamic_16$5ce496c635f96ac1ccd87518d4274b49$aaaSXB$$2salt2","test1"},
{"$dynamic_16$2f49a8804a3aee4da3c219539fc93c6d$123456$$2ssss2","thatsworking"},
{"$dynamic_16$d8deb4f271694c7a9a6c54f5068e3825$5555hh$$2sxxx3","test3"},
// repeat the hash in exactly the same format as it gets stored in john.pot
{"$dynamic_16$d8deb4f271694c7a9a6c54f5068e3825$HEX$3535353568682424327378787833","test3"},
{"$dynamic_16$0b714c79c5790c913a6e44faad39f597$12345678901234567890123$$23IJIps", "1234567890123456789012345678901234567890123456789012345"},
#ifndef MMX_COEF
{"$dynamic_16$1e27f26c540f2980809f4d74989e20e3$12345678901234567890123$$2730ZnC", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"},
Expand Down Expand Up @@ -1044,6 +1048,8 @@ static struct fmt_tests _Preloads_35[] =
{
{"$dynamic_35$a12c6e0d8a4bcabb7f588456cbd20eac3332724d$$UELEV__CHARS","test1"},
{"$dynamic_35$9afbe0bf4e1f24e7e2d9df322b3b284037ac6e19$$UU1","thatsworking"},
// repeat previous hash in exactly the same format that is used for john.pot
{"$dynamic_35$9afbe0bf4e1f24e7e2d9df322b3b284037ac6e19$HEX$24555531","thatsworking"},
{"$dynamic_35$e01ff7a245202eb8b62a653473f078f6a71b5559$$UNINECHARS","test3"},
{"$dynamic_35$a12c6e0d8a4bcabb7f588456cbd20eac3332724d","test1", {"ELEV__CHARS"}},
{"$dynamic_35$9afbe0bf4e1f24e7e2d9df322b3b284037ac6e19","thatsworking", {"U1"}},
Expand Down Expand Up @@ -1079,6 +1085,8 @@ static struct fmt_tests _Preloads_36[] =
{"$dynamic_36$9de18a2891ab0588a0b69938cda83ed9bdd99c32","test1", {"u3"}},
{"$dynamic_36$3549e298740bb9e8148df04f43ba2fb82a052cc4","thatsworking", {"Hank"}},
{"$dynamic_36$11ef4de4baf784d0a1ca33e99a7283ef6b01cdc5","test3", {"sz110"}},
// repeat one hash in exactöy the same format that is used in john.pot:
{"$dynamic_36$9de18a2891ab0588a0b69938cda83ed9bdd99c32$HEX$24557533","test1"},
MTL({"$dynamic_36$151f733540e2813ea1ef42dc879e7c243421d827$$Usevench", "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"},)
{NULL}
};
Expand Down Expand Up @@ -1109,6 +1117,8 @@ static struct fmt_tests _Preloads_37[] =
{"$dynamic_37$13db5f41191e8e7ea5141b16cd58c75af5e27071","test1", {"john"}},
{"$dynamic_37$b8778be2f1c510447bf6a36af8317fd068192d3d","thatsworking", {"bin"}},
{"$dynamic_37$6ceecc888de5f3b86a12f916c750d0667046a1fd","test3", {"2"}},
// repeat in exactly the same form that is used in john.pot
{"$dynamic_37$6ceecc888de5f3b86a12f916c750d0667046a1fd$HEX$245532","test3"},
MTL({"$dynamic_37$398a2ef658dc374790261e6aa8e09f09586e786b$$Ujohn", "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"},)
{NULL}
};
Expand Down Expand Up @@ -1184,6 +1194,8 @@ static struct fmt_tests _Preloads_40[] =
// {"$netsha1$20440a340000000100000000000f4240000f424000000000051c010000000001$709d3307304d790f58bf0a3cefd783b438408996", "password12345"},
// {"$netsha1$20440a340000000100000000000f4240000f424000000000051c010000000002$94bce4d9084199508669b39f044064082a093de3", "password12345"},
{"$dynamic_40$94bce4d9084199508669b39f044064082a093de3$HEX$20440a340000000100000000000f4240000f424000000000051c010000000002","password12345"},
// repeat in the same format that is used for john.pot
{"$dynamic_40$709d3307304d790f58bf0a3cefd783b438408996$HEX$4845582432303434306133343030303030303031303030303030303030303066343234303030306634323430303030303030303030353163303130303030303030303031","password12345"},
{"$dynamic_40$709d3307304d790f58bf0a3cefd783b438408996$HEX$20440a340000000100000000000f4240000f424000000000051c010000000001","password12345"},
{NULL}
};
Expand Down
2 changes: 2 additions & 0 deletions src/formspring_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ john_register_one(&fmt_FORMSPRING);

static struct fmt_tests formspring_tests[] = {
{"2a4fa0bf8c6a01dd625d3141746451ba51e07f99dc9143f1e25a37f65cb02eb4$RA", "test1"},
// repeat in the same format that is used in john.pot
{"$dynamic_61$2a4fa0bf8c6a01dd625d3141746451ba51e07f99dc9143f1e25a37f65cb02eb4$RA", "test1"},
//{"b06b5c132bb1adf421ce6ac406bfabba380546deaab92bd20c3d56baaa70b6cf$ ", "test1"},
//{"cdefb423bad94e3abfe5fc4044bb315a2b875220eb8c8b840849df7ef45bdcef$ ", "test3"},
{NULL}
Expand Down
2 changes: 2 additions & 0 deletions src/haval_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ static int omp_t = 1;
static struct fmt_tests haval_256_3_tests[] = {
{"91850C6487C9829E791FC5B58E98E372F3063256BB7D313A93F1F83B426AEDCC", "HAVAL"},
{"$haval$91850C6487C9829E791FC5B58E98E372F3063256BB7D313A93F1F83B426AEDCC", "HAVAL"},
// john.pot uses lower case hex, so repeat that hash with lower case hex
{"$haval$91850c6487c9829e791fc5b58e98e372f3063256bb7d313a93f1f83b426aedcc", "HAVAL"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/krb5pa-md5_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ static struct fmt_tests tests[] = {
{"$mskrb5$$$881c257ce5df7b11715a6a60436e075a$c80f4a5ec18e7c5f765fb9f00eda744a57483db500271369cf4752a67ca0e67f37c68402", "the"},
{"$mskrb5$$$ef012e13c8b32448241091f4e1fdc805$354931c919580d4939421075bcd50f2527d092d2abdbc0e739ea72929be087de644cef8a", "Ripper"},
{"$mskrb5$$$334ef74dad191b71c43efaa16aa79d88$34ebbad639b2b5a230b7ec1d821594ed6739303ae6798994e72bd13d5e0e32fdafb65413", "VeryveryveryloooooooongPassword"},
// repeat first hash in exactly the same form that is used in john.pot
{"$krb5pa$23$$$$afcbe07c32c3450b37d0f2516354570fe7d3e78f829e77cdc1718adf612156507181f7daeb03b6fbcfe91f8346f3c0ae7e8abfe5", "John"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/mediawiki_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ static struct fmt_tests mediawiki_tests[] = {
{"$B$6$70b3e0907f028877ea47c16496d6df6d", ""},
{"$B$761$3ae7c8e25addfd82544c0c0b1ca8f5e4", "password"},
{"$B$23a0884a$99b4afc91cba24529a9c16ff20e56621", "artist"},
// repeat last hash in exactly the same form that is used in john.pot
{"$dynamic_9$99b4afc91cba24529a9c16ff20e56621$23a0884a-", "artist"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/osc_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ john_register_one(&fmt_OSC);

static struct fmt_tests osc_tests[] = {
{"$OSC$2020$05de5c963ee6234dc7d52f7589a1922b", "welcome"},
// repeat hash in the same form that is used in john.pot
{"$dynamic_4$05de5c963ee6234dc7d52f7589a1922b$ ", "welcome"},

This comment has been minimized.

Copy link
@frank-dittrich

frank-dittrich Jan 1, 2015

Author Collaborator

This line causes a jtrTestSuite problem: openwall/john-tests#31

{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/phpassMD5_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ static struct fmt_tests phpassmd5_tests[] = {
{"$P$8DkV/nqeaQNTdp4NvWjCkgN48AK69X.", "test12345"}, // 1024
{"$P$B12345678L6Lpt4BxNotVIMILOa9u81", "JohnRipper"}, // 8192 (WordPress)
{"$P$91234567xogA.H64Lkk8Cx8vlWBVzH0", "thisisalongertst"},
// repeat in the same format that is used in john.pot
{"$dynamic_17$ogA.H64Lkk8Cx8vlWBVzH0$91234567x", "thisisalongertst"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/pixMD5_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ static struct fmt_tests pixmd5_tests[] = {
{"NuLKvvWGg.x9HEKO", "password"},
{"8Ry2YjIyt7RRXU24", ""},
{".7nfVBEIEu4KbF/1","0123456789abcdef"}, // added a exact 16 byte password, to make sure it works properly
// repeat first hash in exactly the same format that is used in john.pot
{"$dynamic_19$2KFQnbNIdI.2KYOU", "cisco"},
{NULL}
};

Expand Down
2 changes: 2 additions & 0 deletions src/rawSHA1_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ static struct fmt_tests tests[] = {
{"2fbf0eba37de1d1d633bc1ed943b907f9b360d4c", "azertyuiop1"},
{"A9993E364706816ABA3E25717850C26C9CD0D89D", "abc"},
{FORMAT_TAG "A9993E364706816ABA3E25717850C26C9CD0D89D", "abc"},
// repeat hash in exactly the same form that is used in john.pot (lower case)
{FORMAT_TAG "a9993e364706816aba3e25717850c26c9cd0d89d", "abc"},
{"f879f8090e92232ed07092ebed6dc6170457a21d", "azertyuiop2"},
{"1813c12f25e64931f3833b26e999e26e81f9ad24", "azertyuiop3"},
{"095bec1163897ac86e393fa16d6ae2c2fce21602", "7850"},
Expand Down
2 changes: 2 additions & 0 deletions src/rawSHA1_ng_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ static struct fmt_tests sha1_fmt_tests[] = {
{ "b47f363e2b430c0647f14deea3eced9b0ef300ce", "is" },
{ "03d67c263c27a453ef65b29e30334727333ccbcd", "awesome" },
{ "7a73673e78669ea238ca550814dca7000d7026cc", "!!!!1111eleven" },
// repeat last hash in exactly the same format that is used for john.pot
{"$dynamic_26$7a73673e78669ea238ca550814dca7000d7026cc", "!!!!1111eleven"},
{ NULL, NULL }
};

Expand Down
2 changes: 2 additions & 0 deletions src/rawmd5u_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ static struct fmt_tests tests[] = {
{"849ee1b88b5d887bdb058180a666b450", "test3"},
{"8c4cb7e8b33b56a833cdaa8673f3b425", "test4"},
{"537e738b1ac5551f65106368dc301ece", "thatsworking"},
// repeat first hash in exactly the same form that is used in john.pot
{"$dynamic_29$16c47151c18ac087cd12b3a70746c790", "test1"},
{NULL}
};

Expand Down
4 changes: 4 additions & 0 deletions src/skein_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ static int omp_t = 1;
static struct fmt_tests skein_256_tests[] = {
{"39CCC4554A8B31853B9DE7A1FE638A24CCE6B35A55F2431009E18780335D2621", ""},
{"$skein$39CCC4554A8B31853B9DE7A1FE638A24CCE6B35A55F2431009E18780335D2621", ""},
// john.pot uses lower case
{"$skein$39ccc4554a8b31853b9de7a1fe638a24cce6b35a55f2431009e18780335d2621", ""},
{NULL}
};

static struct fmt_tests skein_512_tests[] = {
{"71b7bce6fe6452227b9ced6014249e5bf9a9754c3ad618ccc4e0aae16b316cc8ca698d864307ed3e80b6ef1570812ac5272dc409b5a012df2a579102f340617a", "\xff"},
{"$skein$BC5B4C50925519C290CC634277AE3D6257212395CBA733BBAD37A4AF0FA06AF41FCA7903D06564FEA7A2D3730DBDB80C1F85562DFCC070334EA4D1D9E72CBA7A", ""},
// john.pot uses lower case
{"$skein$bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a", ""},
{NULL}
};

Expand Down
6 changes: 6 additions & 0 deletions src/whirlpool_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,22 @@ static int omp_t = 1;

static struct fmt_tests whirlpool_0_tests[] = {
{"B3E1AB6EAF640A34F784593F2074416ACCD3B8E62C620175FCA0997B1BA2347339AA0D79E754C308209EA36811DFA40C1C32F1A2B9004725D987D3635165D3C8", ""},
// repeat hash in exactly the same form that is used in john.pot
{FORMAT_TAG "B3E1AB6EAF640A34F784593F2074416ACCD3B8E62C620175FCA0997B1BA2347339AA0D79E754C308209EA36811DFA40C1C32F1A2B9004725D987D3635165D3C8", ""},
{NULL}
};

static struct fmt_tests whirlpool_1_tests[] = {
{"470F0409ABAA446E49667D4EBE12A14387CEDBD10DD17B8243CAD550A089DC0FEEA7AA40F6C2AAAB71C6EBD076E43C7CFCA0AD32567897DCB5969861049A0F5A", ""},
// repeat hash in exactly the same form that is used in john.pot
{FORMAT_TAG "470F0409ABAA446E49667D4EBE12A14387CEDBD10DD17B8243CAD550A089DC0FEEA7AA40F6C2AAAB71C6EBD076E43C7CFCA0AD32567897DCB5969861049A0F5A", ""},
{NULL}
};

static struct fmt_tests whirlpool_tests[] = {
{"19FA61D75522A4669B44E39C1D2E1726C530232130D407F89AFEE0964997F7A73E83BE698B288FEBCF88E3E03C4F0757EA8964E59B63D93708B138CC42A66EB3", ""},
// repeat hash in exactly the same form that is used in john.pot
{FORMAT_TAG "19FA61D75522A4669B44E39C1D2E1726C530232130D407F89AFEE0964997F7A73E83BE698B288FEBCF88E3E03C4F0757EA8964E59B63D93708B138CC42A66EB3", ""},
{NULL}
};

Expand Down

9 comments on commit 546a203

@jfoug
Copy link
Collaborator

@jfoug jfoug commented on 546a203 Dec 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to look at ./run/dynamic_flat_sse_formats.conf I am not sure if there are formats in there which you handled here that would benefit from same change. The dyna_flat.conf is for lower number hashes, which have sse 1 limb constraint problems, and are the same number as the lower format, but +2000

@frank-dittrich
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't these formats write canonical hashes for the dyna formats < 2000 into john.pot?
They don't anymore:

(bleeding-jumbo)run $ ./john --format=dynamic_2014 --list=format-tests |cut -f 3|sort -u > h
(bleeding-jumbo)run $ ./john --format=dynamic_2014 --list=format-tests |cut -f 4-|sort -u > p
(bleeding-jumbo)run $ ./john h --wordlist=p
Loaded 3 password hashes with 3 different salts (dynamic_2014 [md5($s.md5($p).$s) (PW > 55 or salt > 11 bytes, sse2) 128/128 AVX 480x4x3])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
test1            (?)
thatsworking     (?)
test3            (?)
3g 0:00:00:00 DONE (2015-01-01 12:34) 300.0g/s 300.0p/s 900.0c/s 900.0C/s test1..thatsworking
Use the "--show" option to display all of the cracked passwords reliably
Session completed
At Program Exit
MemDbg_Validate level 0 checking Passed
(bleeding-jumbo)run $ cat john.pot 
$dynamic_2014$778e40e10d82a08f5377992330008cbe$aaaSXB:test1
$dynamic_2014$d6321956964b2d27768df71d139eabd2$123456:thatsworking
$dynamic_2014$1b3c72e16427a2f4f0819243877f7967$5555hh:test3
(bleeding-jumbo)run $ cat h
$dynamic_2014$1b3c72e16427a2f4f0819243877f7967$5555hh
$dynamic_2014$778e40e10d82a08f5377992330008cbe$aaaSXB
$dynamic_2014$d6321956964b2d27768df71d139eabd2$123456

That's why these formats didn't come up when I searched for formats which missed their canonical hash representation in the self tests.

BTW:
When I try to add this to the dyna 2014 self tests

Test=$dynamic_14$1b3c72e16427a2f4f0819243877f7967$5555hh:test3

the self test fails.

(bleeding-jumbo)run $ ./john --test --format=dynamic_2014
Error, invalid test line (wrong generic type):  Test=$dynamic_14$1b3c72e16427a2f4f0819243877f7967$5555hh:test3
Error parsing section [List.Generic:dynamic_2014]
Error in line 192 file is ./dynamic_flat_sse_formats.conf
Will run 4 OpenMP threads
Benchmarking: dynamic_2014 [md5($s.md5($p).$s) (PW > 55 or salt > 11 bytes, sse2) 128/128 AVX 480x4x3]... (4xOMP) FAILED (valid ($dynamic_14$1b3c72e16427a2f4f0819243877f7967$5555hh))

Should this be a JtR issue?

@jfoug
Copy link
Collaborator

@jfoug jfoug commented on 546a203 Jan 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW:
When I try to add this to the dyna 2014 self tests

Test=$dynamic_14$1b3c72e16427a2f4f0819243877f7967$5555hh:test3

the self test fails.

Why would you think otherwise? dyna_14 is not dyna_2014, even if you conceptually 'think' it is.

Didn't these formats write canonical hashes for the dyna formats < 2000 into john.pot?
They don't anymore:

They never have. They are new functions. They do not work hand in hand with the lower ones. Yes, they could write them like that into the .pot file, since that file is not read to be processed, BUT if it is (like in the TS), you will now have hashes which can not be cracked, since they will be processed by lower dyna formats. So you cracked a dyna_2014 with a 75 byte password. Store is as dyna_14, and now it can not be cracked by the hash that lists it.

@frank-dittrich
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this has been discussed, but I must be wrong, since I can't find that discussion.
dynamic_14 and dynamic_2014 both are able to process the same raw hashes.

(bleeding-jumbo)run $ cat h
1b3c72e16427a2f4f0819243877f7967$5555hh
778e40e10d82a08f5377992330008cbe$aaaSXB
d6321956964b2d27768df71d139eabd2$123456
(bleeding-jumbo)run $ ./john h --wordlist=p --format=dynamic_14
Loaded 3 password hashes with 3 different salts (dynamic_14 [md5($s.md5($p).$s) 128/128 AVX 480x4x3])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
test3            (?)
test1            (?)
thatsworking     (?)
3g 0:00:00:00 DONE (2015-01-01 15:21) 300.0g/s 300.0p/s 900.0c/s 900.0C/s test1..thatsworking
Use the "--show" option to display all of the cracked passwords reliably
Session completed
At Program Exit
MemDbg_Validate level 0 checking Passed
(bleeding-jumbo)run $ ./john h --wordlist=p --format=dynamic_2014
Loaded 3 password hashes with 3 different salts (dynamic_2014 [md5($s.md5($p).$s) (PW > 55 or salt > 11 bytes, sse2) 128/128 AVX 480x4x3])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
test3            (?)
thatsworking     (?)
test1            (?)
3g 0:00:00:00 DONE (2015-01-01 15:21) 300.0g/s 300.0p/s 900.0c/s 900.0C/s test1..thatsworking
Use the "--show" option to display all of the cracked passwords reliably
Session completed
At Program Exit
MemDbg_Validate level 0 checking Passed
(bleeding-jumbo)run $ cat john.pot 
$dynamic_14$1b3c72e16427a2f4f0819243877f7967$5555hh:test3
$dynamic_14$778e40e10d82a08f5377992330008cbe$aaaSXB:test1
$dynamic_14$d6321956964b2d27768df71d139eabd2$123456:thatsworking
$dynamic_2014$1b3c72e16427a2f4f0819243877f7967$5555hh:test3
$dynamic_2014$d6321956964b2d27768df71d139eabd2$123456:thatsworking
$dynamic_2014$778e40e10d82a08f5377992330008cbe$aaaSXB:test1

It would be great if you wouldn't need to re-crack hashes for dynamic_14 that have already been cracked with dynamic_2014 and vice versa.
(I know that dynamic_14 cannot crack all the hashes dynamic_2014 can crack, e.g., due to max. password length limit. But what prevemts dynamic_14 from recognizing the dynamic_2014 hashes in john.pot when using --show or when loading hashes? Most likely only the fact that nobody implemented it.)

@frank-dittrich
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I am not that demented.
We had that discussion, at least a similar discussion, on john-dev.

http://thread.gmane.org/gmane.comp.security.openwall.john.devel/10404

@frank-dittrich
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfoug
Copy link
Collaborator

@jfoug jfoug commented on 546a203 Jan 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is aliasing, which I started on, but somewhat abandoned, due to all sorts of nuanced bugs that kept creeping up.

In no way should we modify dynamic14 to some how know about dynamic2014, or 2014 to know about 14. The alias 'concept' was good idea, but it simply had enough issues that I am not sure it will ever be solid enough to release prime time.

@jfoug
Copy link
Collaborator

@jfoug jfoug commented on 546a203 Jan 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE, we 'could' add a limited alias abliilty, at least within the dynamic, and I think I probably 'could' get that solid. That is only part of the alias problem, but it is a significant part of it. I know that @magnumripper had me 'hide' some of the dynamic formats recently (the text book and self testing formats). While I am not too keen for doing that, since I think it describes for users just what 'can' be done, and if users do not see that, then they do not know how/what can be done within dyna. But one other complaint @magnumripper was that there are many dupes in dyna. Yes, there are formats that 'can' process the same hashes, and there are some dupes. But there are also some 2-class formats. One that is quicker but limited to a 55 byte input limb on SIMD, and one that is a little slower, but users FLAT buffer SIMD so does not have unreasonable length limits.

I could see adding dynamic only aliasing as a phase-1 I originally thought alias code would be a smaller undertaking. It is not. It 'really' needs to have core changes to have a couple methods added to the formats to 'help'. But instead of doing this like this, or like I was doing (which was piece meal ad-hoc), we really should address this in a an engineering design way, by asking what we have, and what we need to get the job done. (SORRY for long rant, it should be done on some other thread).

@magnumripper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there are also some 2-class formats. One that is quicker but limited to a 55 byte input limb on SIMD, and one that is a little slower, but users FLAT buffer SIMD so does not have unreasonable length limits.

With the current code, if you attack 1000 (bare) hashes with dynamic_1 and crack 300 of them, then try to use dynamic_2001 to crack some with longer passwords, John will load all 1000 as uncracked, right? Getting rid of such little issues would be a good enhancement.

Please sign in to comment.