diff -urpN memdbg2/doc/DYNAMIC memdbg1/doc/DYNAMIC --- memdbg2/doc/DYNAMIC 2013-05-13 08:56:37.421875000 -0500 +++ memdbg1/doc/DYNAMIC 2013-05-13 07:49:21.109375000 -0500 @@ -206,6 +206,14 @@ dynamic_104 | WHIRLPOOL(WHIRLPOOL_raw($p dynamic_105 | WHIRLPOOL(WHIRLPOOL($p).$s) | Yes | dynamic_106 | WHIRLPOOL($s.WHIRLPOOL($p)) | Yes | dynamic_107 | WHIRLPOOL(WHIRLPOOL($s).WHIRLPOOL($p)) | Yes | +dynamic_110 | Tiger($p) | No | +dynamic_111 | Tiger($s.$p) | Yes | +dynamic_112 | Tiger($p.$s) | Yes | +dynamic_113 | Tiger(Tiger($p)) | No | +dynamic_114 | Tiger(Tiger_raw($p)) | No | +dynamic_115 | Tiger(Tiger($p).$s) | Yes | +dynamic_116 | Tiger($s.Tiger($p)) | Yes | +dynamic_117 | Tiger(Tiger($s).Tiger($p)) | Yes | ........ | RESERVED | UNK | dynamic_999 | RESERVED | UNK | diff -urpN memdbg2/run/dynamic.conf memdbg1/run/dynamic.conf --- memdbg2/run/dynamic.conf 2013-05-13 08:56:38.328125000 -0500 +++ memdbg1/run/dynamic.conf 2013-05-12 16:25:46.000000000 -0500 @@ -1,6 +1,44 @@ # Here are some examples of DYNAMIC. # Please refer to ./doc/DYNAMIC for documentation on how to set these up. # Format names up to dynamic_999 are reserved for builtin functions. + +#################################################################### +# here is a synopsis of the formats in this file. Please keep this up to date +#################################################################### +#################################################################### +# dynamic_1001: md5(md5(md5(md5($p)))) +# dynamic_1002: md5(md5(md5(md5(md5($p))))) +# dynamic_1003: md5(md5($p).md5($p)) +# dynamic_1004: md5(md5(md5(md5(md5(md5($p)))))) +# dynamic_1005: md5(md5(md5(md5(md5(md5(md5($p))))))) +# dynamic_1006: md5(md5(md5(md5(md5(md5(md5(md5($p)))))))) +# dynamic_1007: md5(md5($p).$s) (vBulletin) +# dynamic_1008: md5($p.$s) (RADIUS User-Password) +# dynamic_1009: md5($s.$p) (RADIUS Responses) +# dynamic_1010: md5($p null_padded_to_len_100) RAdmin v2.x MD5 +# dynamic_1011: md5($p.md5($s)) (WebEdition CMS) +# dynamic_1012: md5($p.md5($s)) (WebEdition CMS) +# dynamic_1013: md5($p.PMD5(username)) (WebEdition CMS) +# dynamic_1014: md5($p.$s) (long salt) +# dynamic_1015: md5(md5($p.$u).$s) +# dynamic_1018: md5(sha1(sha1($pass))) +# dynamic_1019: md5(sha1(sha1(md5($pass)))) +# dynamic_1020: md5(sha1(md5($pass))) +# dynamic_1021: md5(sha1(md5(sha1($pass)))) +# dynamic_1022: md5(sha1(md5(sha1(md5($pass))))) +# dynamic_1023: sha1($pass) (first 32 bytes) +# dynamic_1024: sha1(md5($pass)) (first 32 bytes) +# dynamic_1025: sha1(md5(md5($pass))) (first 32 bytes) +# dynamic_1026: sha1(sha1($pass))) (first 32 bytes) +# dynamic_1027: sha1(sha1(sha1($pass)))) (first 32 bytes) +# dynamic_1028: sha1(sha1_raw($pass)) (first 32 bytes) +# dynamic_1029: sha256($pass) (first 32 bytes) +# dynamic_1030: Whirlpool($pass) (first 32 bytes) +# dynamic_1031: GOST($pass) (first 32 bytes) +# dynamic_1300: md5(md5_raw($pass)) +# dynamic_1350: md5(md5($s.$p):$s) +#################################################################### + #################################################################### # Simple DYNAMIC type for md5($p)^^4 (i.e. 4 steps of md5 recursively) #################################################################### @@ -475,9 +513,9 @@ Flag=MGF_NOTSSE2Safe Func=DynamicFunc__clean_input Func=DynamicFunc__append_keys Func=DynamicFunc__SHA256_crypt_input1_to_output1_FINAL -Test=$dynamic_1029$e4ad93ca07acb8d908a3aa41e920ea4f:iloveyou -Test=$dynamic_1029$13b1f7ec5beaefc781e43a3b344371cd:freedom -Test=$dynamic_1029$aa97302150fce811425cd84537028a5a:computer +Test=$dynamic_1029$e4ad93ca07acb8d908a3aa41e920ea4f:iloveyou +Test=$dynamic_1029$13b1f7ec5beaefc781e43a3b344371cd:freedom +Test=$dynamic_1029$aa97302150fce811425cd84537028a5a:computer [List.Generic:dynamic_1030] Expression=Whirlpool($pass) (first 32 bytes) @@ -485,9 +523,9 @@ Flag=MGF_NOTSSE2Safe Func=DynamicFunc__clean_input Func=DynamicFunc__append_keys Func=DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL -Test=$dynamic_1030$56fd4ecb153a08b65a73b51e3c8ca369:spiral -Test=$dynamic_1030$6b116ef0c32185d3ae1136f4593a5cae:defender -Test=$dynamic_1030$fee8605795f28dda386324d59a28ba99:amazon +Test=$dynamic_1030$56fd4ecb153a08b65a73b51e3c8ca369:spiral +Test=$dynamic_1030$6b116ef0c32185d3ae1136f4593a5cae:defender +Test=$dynamic_1030$fee8605795f28dda386324d59a28ba99:amazon [List.Generic:dynamic_1031] Expression=GOST($pass) (first 32 bytes) @@ -497,6 +535,7 @@ Func=DynamicFunc__append_keys Func=DynamicFunc__GOST_crypt_input1_to_output1_FINAL Test=$dynamic_1031$0e8cd409a23c2e7ad1c5b22b101dfa16:admin + [List.Generic:dynamic_1300] Expression=md5(md5_raw($pass)) Func=DynamicFunc__clean_input @@ -507,7 +546,7 @@ Func=DynamicFunc__crypt_md5 Test=$dynamic_1300$43442676c74ae59f219c2d87fd6bad52:admin [List.Generic:dynamic_1350]: -Expression=md5(md5($s.$p):$s); +Expression=md5(md5($s.$p):$s) # Flag needed here, is Salt. CONST1=: Flag=MGF_SALTED diff -urpN memdbg2/run/pass_gen.pl memdbg1/run/pass_gen.pl --- memdbg2/run/pass_gen.pl 2013-05-11 18:28:32.500000000 -0500 +++ memdbg1/run/pass_gen.pl 2013-05-13 08:54:42.562500000 -0500 @@ -20,6 +20,8 @@ use Digest::HMAC_MD5; use Digest; # Whirlpool is gotten from Digest->new('Whirlpool') use Digest::SHA qw(sha1 sha1_hex sha1_base64 sha224 sha224_hex sha224_base64 sha256 sha256_hex sha256_base64 sha384 sha384_hex sha384_base64 sha512 sha512_hex sha512_base64 ); use Digest::GOST qw(gost gost_hex gost_base64); +use Digest::Haval256; +use Digest::Tiger; use Encode; use Switch 'Perl5', 'Perl6'; use POSIX; @@ -407,7 +409,41 @@ sub whirlpool { $ret = pack "H*", $h; return $ret; } -############################################################################# +sub haval256 { + my $hash = new Digest::Haval256; + $hash->add( $_[0] ); + my $h = $hash->hexdigest; + my $ret = pack "H*", $h; + return $ret; +} +sub haval256_hex { + my $hash = new Digest::Haval256; + $hash->add( $_[0] ); + return $hash->hexdigest; +} +sub haval256_base64 { + my $hash = new Digest::Haval256; + $hash->add( $_[0] ); + return $hash->base64digest; +} +sub tiger_hex { + return lc Digest::Tiger::hexhash($_[0]); +} +sub tiger { +# return Digest::Tiger::hash($_[0]); + my $h = tiger_hex($_[0]); + my $ret = pack "H*", $h; + return $ret; +} +sub tiger_base64 { +# my $haval = Digest::Tiger::hash('Tiger') +# $haval->add( $_[0] ); +# return $haval->base64digest; + print "tiger_base64 is not working yet\n"; + return Digest::Tiger::hexhash($_[0]); +# this function is not right, but simply here to compile properly. +} +############################################################################ # Here are the encryption subroutines. # the format of ALL of these is: function(password) # all salted formats choose 'random' salts, in one way or another. @@ -1630,12 +1666,12 @@ sub dynamic_compile { print " Added \$s2 (if 2nd salt is defined),\n"; print " Added \$c1 to \$c9 for constants (must be defined in const#= values)\n"; print " Added \$u if user name (normal, upper/lower case or unicode convert)\n"; - print " Handle md5, sha1, md4 sha2 (sha224,sha256,sha384,sha512) gost and whirlpool crypts.\n"; - print " Handle MD5, SHA1, MD4 SHA2 (all uc(sha2) types) GOST WHILRPOOL which output hex in uppercase.\n"; - print " Handle md5u, sha1u md4u, sha2*u gostu whirlpoolu which encode to UTF16LE.\n"; + print " Handle md5, sha1, md4 sha2 (sha224,sha256,sha384,sha512) gost whirlpool tiger and haval crypts.\n"; + print " Handle MD5, SHA1, MD4 SHA2 (all uc(sha2) types) GOST WHILRPOOL TIGER HAVAL which output hex in uppercase.\n"; + print " Handle md5u, sha1u md4u, sha2*u gostu whirlpoolu tigeru havalu which encode to UTF16LE.\n"; print " prior to hashing. Warning, be careful with md5u and usrname=uni,\n"; print " they will 'clash'\n"; - print " Handle md5_64, sha1_64, md4_64, sha2*_64 gost_64 whirlpool_64 which output in\n"; + print " Handle md5_64, sha1_64, md4_64, sha2*_64 gost_64 whirlpool_64 tiger_64 haval_64 which output in\n"; print " 'standard' base-64 which is \"./0-9A-Za-z\"\n"; print " Handle md5_64e, sha1_64e, md4_64e, sha2*_64e goste, whirlpoole which output in\n"; print " 'standard' base-64 which is \"./0-9A-Za-z\" with '=' padding up to even\n"; @@ -1699,23 +1735,61 @@ sub dynamic_compile { $dynamic_args==37 && do {$fmt='sha1($u.$p),usrname=lc'; last SWITCH; }; $dynamic_args==38 && do {$fmt='sha1($s.sha1($s.sha1($p))),saltlen=20'; last SWITCH; }; $dynamic_args==50 && do {$fmt='sha224($p)'; last SWITCH; }; - $dynamic_args==51 && do {$fmt='sha224($s.$p),saltlen=2'; last SWITCH; }; + $dynamic_args==51 && do {$fmt='sha224($s.$p),saltlen=6'; last SWITCH; }; $dynamic_args==52 && do {$fmt='sha224($p.$s)'; last SWITCH; }; + $dynamic_args==53 && do {$fmt='sha224(sha224($p)'; last SWITCH; }; + $dynamic_args==54 && do {$fmt='sha224(sha224_raw($p))'; last SWITCH; }; + $dynamic_args==55 && do {$fmt='sha224(sha224($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==56 && do {$fmt='sha224($s.sha224($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==57 && do {$fmt='sha224(sha224($s).sha224($p)),saltlen=6'; last SWITCH; }; $dynamic_args==60 && do {$fmt='sha256($p)'; last SWITCH; }; - $dynamic_args==61 && do {$fmt='sha256($s.$p),saltlen=2'; last SWITCH; }; + $dynamic_args==61 && do {$fmt='sha256($s.$p),saltlen=6'; last SWITCH; }; $dynamic_args==62 && do {$fmt='sha256($p.$s)'; last SWITCH; }; + $dynamic_args==63 && do {$fmt='sha256(sha256($p)'; last SWITCH; }; + $dynamic_args==64 && do {$fmt='sha256(sha256_raw($p))'; last SWITCH; }; + $dynamic_args==65 && do {$fmt='sha256(sha256($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==66 && do {$fmt='sha256($s.sha256($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==67 && do {$fmt='sha256(sha256($s).sha256($p)),saltlen=6'; last SWITCH; }; $dynamic_args==70 && do {$fmt='sha384($p)'; last SWITCH; }; - $dynamic_args==71 && do {$fmt='sha384($s.$p),saltlen=2'; last SWITCH; }; + $dynamic_args==71 && do {$fmt='sha384($s.$p),saltlen=6'; last SWITCH; }; $dynamic_args==72 && do {$fmt='sha384($p.$s)'; last SWITCH; }; + $dynamic_args==73 && do {$fmt='sha384(sha384($p)'; last SWITCH; }; + $dynamic_args==74 && do {$fmt='sha384(sha384_raw($p))'; last SWITCH; }; + $dynamic_args==75 && do {$fmt='sha384(sha384($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==76 && do {$fmt='sha384($s.sha384($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==77 && do {$fmt='sha384(sha384($s).sha384($p)),saltlen=6'; last SWITCH; }; $dynamic_args==80 && do {$fmt='sha512($p)'; last SWITCH; }; - $dynamic_args==81 && do {$fmt='sha512($s.$p),saltlen=2'; last SWITCH; }; + $dynamic_args==81 && do {$fmt='sha512($s.$p),saltlen=6'; last SWITCH; }; $dynamic_args==82 && do {$fmt='sha512($p.$s)'; last SWITCH; }; + $dynamic_args==83 && do {$fmt='sha512(sha512($p)'; last SWITCH; }; + $dynamic_args==84 && do {$fmt='sha512(sha512_raw($p))'; last SWITCH; }; + $dynamic_args==85 && do {$fmt='sha512(sha512($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==86 && do {$fmt='sha512($s.sha512($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==87 && do {$fmt='sha512(sha512($s).sha512($p)),saltlen=6'; last SWITCH; }; $dynamic_args==90 && do {$fmt='gost($p)'; last SWITCH; }; - $dynamic_args==91 && do {$fmt='gost($s.$p),saltlen=2'; last SWITCH; }; + $dynamic_args==91 && do {$fmt='gost($s.$p),saltlen=6'; last SWITCH; }; $dynamic_args==92 && do {$fmt='gost($p.$s)'; last SWITCH; }; - $dynamic_args==100 && do {$fmt='whirlpool($p)'; last SWITCH; }; - $dynamic_args==101 && do {$fmt='whirlpool($s.$p),saltlen=2'; last SWITCH; }; - $dynamic_args==102 && do {$fmt='whirlpool($p.$s)'; last SWITCH; }; + $dynamic_args==93 && do {$fmt='gost(gost($p)'; last SWITCH; }; + $dynamic_args==94 && do {$fmt='gost(gost_raw($p))'; last SWITCH; }; + $dynamic_args==95 && do {$fmt='gost(gost($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==96 && do {$fmt='gost($s.gost($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==97 && do {$fmt='gost(gost($s).gost($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==100 && do {$fmt='whirlpool($p)'; last SWITCH; }; + $dynamic_args==101 && do {$fmt='whirlpool($s.$p),saltlen=6'; last SWITCH; }; + $dynamic_args==102 && do {$fmt='whirlpool($p.$s)'; last SWITCH; }; + $dynamic_args==103 && do {$fmt='whirlpool(whirlpool($p)'; last SWITCH; }; + $dynamic_args==104 && do {$fmt='whirlpool(whirlpool_raw($p))'; last SWITCH; }; + $dynamic_args==105 && do {$fmt='whirlpool(whirlpool($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==106 && do {$fmt='whirlpool($s.whirlpool($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==107 && do {$fmt='whirlpool(whirlpool($s).whirlpool($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==110 && do {$fmt='tiger($p)'; last SWITCH; }; + $dynamic_args==111 && do {$fmt='tiger($s.$p),saltlen=6'; last SWITCH; }; + $dynamic_args==112 && do {$fmt='tiger($p.$s)'; last SWITCH; }; + $dynamic_args==113 && do {$fmt='tiger(tiger($p))'; last SWITCH; }; + $dynamic_args==114 && do {$fmt='tiger(tiger_raw($p))'; last SWITCH; }; + $dynamic_args==115 && do {$fmt='tiger(tiger($p).$s),saltlen=6'; last SWITCH; }; + $dynamic_args==116 && do {$fmt='tiger($s.tiger($p)),saltlen=6'; last SWITCH; }; + $dynamic_args==117 && do {$fmt='tiger(tiger($s).tiger($p)),saltlen=6'; last SWITCH; }; # 7, 17, 19, 20, 21, 27, 28 are still handled by 'special' functions. @@ -1729,8 +1803,29 @@ sub dynamic_compile { $dynamic_args==1007 && do {$fmt='md5(md5($p).$s)'; last SWITCH; }; $dynamic_args==1008 && do {$fmt='md5($p.$s),saltlen=16'; last SWITCH; }; $dynamic_args==1009 && do {$fmt='md5($s.$p),saltlen=16'; last SWITCH; }; - $dynamic_args==1010 && do {$fmt='sha256($s.$p),saltlen=2'; last SWITCH; }; # dyna-1010 not handled yet (the pad null to 100 bytes) + $dynamic_args==1011 && do {$fmt='md5($p.md5($s)),saltlen=6'; last SWITCH; }; + $dynamic_args==1012 && do {$fmt='md5($p.md5($s)),saltlen=6'; last SWITCH; }; + $dynamic_args==1013 && do {$fmt='md5($p.md5($u)),username'; last SWITCH; }; + $dynamic_args==1014 && do {$fmt='md5($p.$s),saltlen=56'; last SWITCH; }; + $dynamic_args==1015 && do {$fmt='md5(md5($p.$u).$s),saltlen=6,username'; last SWITCH; }; + $dynamic_args==1018 && do {$fmt='md5(sha1(sha1($p)))'; last SWITCH; }; + $dynamic_args==1019 && do {$fmt='md5(sha1(sha1(md5($p))))'; last SWITCH; }; + $dynamic_args==1020 && do {$fmt='md5(sha1(md5($p)))'; last SWITCH; }; + $dynamic_args==1021 && do {$fmt='md5(sha1(md5(sha1($p))))'; last SWITCH; }; + $dynamic_args==1022 && do {$fmt='md5(sha1(md5(sha1(md5($p)))))'; last SWITCH; }; + $dynamic_args==1023 && do {$fmt='trunc32(sha1($p))'; last SWITCH; }; + $dynamic_args==1024 && do {$fmt='trunc32(sha1(md5($p)))'; last SWITCH; }; + $dynamic_args==1025 && do {$fmt='trunc32(sha1(md5(md5($p))))'; last SWITCH; }; + $dynamic_args==1026 && do {$fmt='trunc32(sha1(sha1($p)))'; last SWITCH; }; + $dynamic_args==1027 && do {$fmt='trunc32(sha1(sha1(sha1($p))))'; last SWITCH; }; + $dynamic_args==1028 && do {$fmt='trunc32(sha1(sha1_raw($p)))'; last SWITCH; }; + $dynamic_args==1029 && do {$fmt='trunc32(sha256($p))'; last SWITCH; }; + $dynamic_args==1030 && do {$fmt='trunc32(whirlpool($p))'; last SWITCH; }; + $dynamic_args==1031 && do {$fmt='trunc32(gost($p))'; last SWITCH; }; + $dynamic_args==1300 && do {$fmt='md5(md5_raw($p))'; last SWITCH; }; + $dynamic_args==1350 && do {$fmt='md5(md5($s.$p).$c1.$s),saltlen=2,const1=:'; last SWITCH; }; + return $func; } # allow the generic compiler to handle these types. @@ -1793,7 +1888,10 @@ sub do_dynamic_GetToken { if (substr($exprStr, 0,10) eq "sha384_raw") { push(@gen_toks, "f384r"); return substr($exprStr,10); } if (substr($exprStr, 0,10) eq "sha512_raw") { push(@gen_toks, "f512r"); return substr($exprStr,10); } if (substr($exprStr, 0, 8) eq "gost_raw") { push(@gen_toks, "fgostr");return substr($exprStr, 8); } - if (substr($exprStr, 0,13) eq "whirlpool_raw") { push(@gen_toks, "fwrlpr");return substr($exprStr, 13); } + if (substr($exprStr, 0,13) eq "whirlpool_raw") { push(@gen_toks, "fwrlpr");return substr($exprStr, 13); } + if (substr($exprStr, 0, 9) eq "tiger_raw") { push(@gen_toks, "ftigr"); return substr($exprStr, 9); } + if (substr($exprStr, 0,13) eq "ripemd160_raw") { push(@gen_toks, "fripr"); return substr($exprStr,13); } + if (substr($exprStr, 0,12) eq "haval256_raw") { push(@gen_toks, "fhavr"); return substr($exprStr,12); } $gen_lastTokIsFunc=1; $stmp = uc substr($exprStr, 0, 3); @@ -1847,6 +1945,26 @@ sub do_dynamic_GetToken { if (substr($exprStr, 0,10) eq "whirlpoolu") { push(@gen_toks, "fwrlpu"); return substr($exprStr, 10); } if (substr($exprStr, 0, 9) eq "WHIRLPOOL") { push(@gen_toks, "fwrlpH"); return substr($exprStr, 9); } if (substr($exprStr, 0, 9) eq "whirlpool") { push(@gen_toks, "fwrlph"); return substr($exprStr, 9); } + } elsif ($stmp eq "TIG") { + if (substr($exprStr, 0, 9) eq "tiger_64e") { push(@gen_toks, "ftige"); return substr($exprStr, 9); } + if (substr($exprStr, 0, 8) eq "tiger_64") { push(@gen_toks, "ftig6"); return substr($exprStr, 8); } + if (substr($exprStr, 0, 6) eq "tigeru") { push(@gen_toks, "ftigu"); return substr($exprStr, 6); } + if (substr($exprStr, 0, 5) eq "TIGER") { push(@gen_toks, "ftigH"); return substr($exprStr, 5); } + if (substr($exprStr, 0, 5) eq "tiger") { push(@gen_toks, "ftigh"); return substr($exprStr, 5); } + } elsif ($stmp eq "RIP") { + if (substr($exprStr, 0,13) eq "ripemd160_64e") { push(@gen_toks, "fripe"); return substr($exprStr,13); } + if (substr($exprStr, 0,12) eq "ripemd160_64") { push(@gen_toks, "frip6"); return substr($exprStr,12); } + if (substr($exprStr, 0,10) eq "ripemd160u") { push(@gen_toks, "fripu"); return substr($exprStr,10); } + if (substr($exprStr, 0, 9) eq "RIPEMD160") { push(@gen_toks, "fripH"); return substr($exprStr, 9); } + if (substr($exprStr, 0, 9) eq "ripemd160") { push(@gen_toks, "friph"); return substr($exprStr, 9); } + } elsif ($stmp eq "HAV") { + if (substr($exprStr, 0,12) eq "haval256_64e") { push(@gen_toks, "fhave"); return substr($exprStr,12); } + if (substr($exprStr, 0,11) eq "haval256_64") { push(@gen_toks, "fhav6"); return substr($exprStr,11); } + if (substr($exprStr, 0, 9) eq "haval256u") { push(@gen_toks, "fhavu"); return substr($exprStr, 9); } + if (substr($exprStr, 0, 8) eq "HAVEL256") { push(@gen_toks, "fhavH"); return substr($exprStr, 8); } + if (substr($exprStr, 0, 8) eq "haval256") { push(@gen_toks, "fhavh"); return substr($exprStr, 8); } + } elsif ($stmp eq "TRU") { + if (substr($exprStr, 0,7) eq "trunc32") { push(@gen_toks, "ftr32"); return substr($exprStr, 7); } } $gen_lastTokIsFunc=0; @@ -2240,6 +2358,7 @@ sub dynamic_app_6 { $gen_Stack[@gen_Sta sub dynamic_app_7 { $gen_Stack[@gen_Stack-1] .= $gen_c[6]; } sub dynamic_app_8 { $gen_Stack[@gen_Stack-1] .= $gen_c[7]; } sub dynamic_app_9 { $gen_Stack[@gen_Stack-1] .= $gen_c[8]; } +sub dynamic_ftr32 { $h = pop @gen_Stack; $h = substr($h,0,32); $gen_Stack[@gen_Stack-1] .= $h; return $h; } sub dynamic_f5h { $h = pop @gen_Stack; $h = md5_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } sub dynamic_f1h { $h = pop @gen_Stack; $h = sha1_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } sub dynamic_f4h { $h = pop @gen_Stack; $h = md4_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } @@ -2294,3 +2413,21 @@ sub dynamic_fwrlp6 { $h = pop @gen_Stack sub dynamic_fwrlpe { $h = pop @gen_Stack; $h = whirlpool_base64($h); while (length($h)%4) { $h .= "="; } $gen_Stack[@gen_Stack-1] .= $h; return $h; } sub dynamic_fwrlpu { $h = pop @gen_Stack; $h = whirlpool_hex(encode("UTF-16LE",$h)); $gen_Stack[@gen_Stack-1] .= $h; return $h; } sub dynamic_fwrlpr { $h = pop @gen_Stack; $h = whirlpool($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftigh { $h = pop @gen_Stack; $h = tiger_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftigH { $h = pop @gen_Stack; $h = uc tiger_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftig6 { $h = pop @gen_Stack; $h = tiger_base64($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftige { $h = pop @gen_Stack; $h = tiger_base64($h); while (length($h)%4) { $h .= "="; } $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftigu { $h = pop @gen_Stack; $h = tiger_hex(encode("UTF-16LE",$h)); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_ftigr { $h = pop @gen_Stack; $h = tiger($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_friph { $h = pop @gen_Stack; $h = ripemd160_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fripH { $h = pop @gen_Stack; $h = uc ripemd160_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_frip6 { $h = pop @gen_Stack; $h = ripemd160_base64($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fripe { $h = pop @gen_Stack; $h = ripemd160_base64($h); while (length($h)%4) { $h .= "="; } $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fripu { $h = pop @gen_Stack; $h = ripemd160_hex(encode("UTF-16LE",$h)); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fripr { $h = pop @gen_Stack; $h = ripemd160($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhavh { $h = pop @gen_Stack; $h = haval256_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhavH { $h = pop @gen_Stack; $h = uc haval256_hex($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhav6 { $h = pop @gen_Stack; $h = haval256_base64($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhave { $h = pop @gen_Stack; $h = haval256_base64($h); while (length($h)%4) { $h .= "="; } $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhavu { $h = pop @gen_Stack; $h = haval256_hex(encode("UTF-16LE",$h)); $gen_Stack[@gen_Stack-1] .= $h; return $h; } +sub dynamic_fhavr { $h = pop @gen_Stack; $h = haval256($h); $gen_Stack[@gen_Stack-1] .= $h; return $h; } diff -urpN memdbg2/src/dynamic.h memdbg1/src/dynamic.h --- memdbg2/src/dynamic.h 2013-05-13 08:56:40.953125000 -0500 +++ memdbg1/src/dynamic.h 2013-05-13 08:15:02.687500000 -0500 @@ -18,7 +18,7 @@ * Renamed and changed from md5_gen* to dynamic*. We handle MD5 and SHA1 * at the present time. More crypt types 'may' be added later. * Added SHA2 (SHA224, SHA256, SHA384, SHA512), GOST, Whirlpool crypt types. - * Whirlpool only if OPENSSL_VERSION_NUMBER >= 0x10000000 + * Whirlpool use oSSSL if OPENSSL_VERSION_NUMBER >= 0x10000000, otherwise use sph_* code. */ #if !defined (__DYNAMIC___H) @@ -115,6 +115,7 @@ typedef struct DYNAMIC_Constants_t #define MGF_SHA512_128_BYTE_FINISH 0x02000000 #define MGF_GOST_64_BYTE_FINISH 0x04000000 #define MGF_WHIRLPOOL_128_BYTE_FINISH 0x08000000 +#define MGF_Tiger_48_BYTE_FINISH 0x10000000 typedef struct DYNAMIC_Setup_t { @@ -348,7 +349,6 @@ extern void DynamicFunc__GOST_crypt_inpu extern void DynamicFunc__GOST_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS); extern void DynamicFunc__GOST_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS); -#if OPENSSL_VERSION_NUMBER >= 0x10000000 extern void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS); @@ -357,7 +357,15 @@ extern void DynamicFunc__WHIRLPOOL_crypt extern void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS); -#endif + +extern void DynamicFunc__Tiger_crypt_input1_append_input2(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_append_input1(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS); // These 3 dump the raw crypt back into input (only at the head of it). // they are for phpass, wordpress, etc. @@ -427,14 +435,17 @@ extern void DynamicFunc__GOST_crypt_inpu extern void DynamicFunc__GOST_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__GOST_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__GOST_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS); -#if OPENSSL_VERSION_NUMBER >= 0x10000000 extern void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS); extern void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS); -#endif - +extern void DynamicFunc__Tiger_crypt_input1_append_input2_base16(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_append_input1_base16(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input1_overwrite_input1_base16(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS); +extern void DynamicFunc__Tiger_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS); #endif // __DYNAMIC___H diff -urpN memdbg2/src/dynamic_big_crypt.c memdbg1/src/dynamic_big_crypt.c --- memdbg2/src/dynamic_big_crypt.c 1969-12-31 18:00:00.000000000 -0600 +++ memdbg1/src/dynamic_big_crypt.c 2013-05-13 09:18:09.234375000 -0500 @@ -0,0 +1,2169 @@ +/* + * This software was written by Jim Fougeron jfoug AT cox dot net + * in 2013. No copyright is claimed, and the software is hereby + * placed in the public domain. In case this attempt to disclaim + * copyright and place the software in the public domain is deemed + * null and void, then the software is Copyright (c) 2013 Jim Fougeron + * and it is hereby released to the general public under the following + * terms: + * + * This software may be modified, redistributed, and used for any + * purpose, in source and binary forms, with or without modification. + * + * Generic 'scriptable' hash cracker for JtR. These are the 'larger' crypt + * items. They have been separated from dynamic_fmt.c, and placed into this + * stand alone file. In this code, there are a lot of lines of code, but + * the code is very cookie cutter. + * + */ + +#include "arch.h" +#if defined (MMX_COEF) && MMX_COEF==2 && defined (_OPENMP) +// NO thread support for MMX. Only OpenSSL (CTX model), or SSE intrinsics have +// thread support. The older md5_mmx.S/sha1_mmx.S files are NOT thread safe. +#undef _OPENMP +#define WAS_MMX_OPENMP +#endif +#include "misc.h" +#include "common.h" +#include "formats.h" +#include "dynamic.h" +#include "sha2.h" +#include "gost.h" +// this one is going to be harder. only haval_256_5 is implemented in CPAN perl, making genation of test cases harder. +// Also, there are 15 different hashes in this 'family'. +#include "sph_haval.h" + +#include "sph_ripemd.h" +#include "sph_tiger.h" +#include "sph_whirlpool.h" + +#include "johnswap.h" + +#if OPENSSL_VERSION_NUMBER >= 0x10000000 +#define USING_OSSL_WHRLP +#include "openssl/whrlpool.h" +#else +// on my 32 bit cygwin builds, this code is about 4x slower than the oSSL code. +#define WHIRLPOOL_CTX sph_whirlpool_context +#define WHIRLPOOL_Init(a) sph_whirlpool_init(a) +#define WHIRLPOOL_Update(a,b,c) sph_whirlpool(a,b,c) +#define WHIRLPOOL_Final(a,b) sph_whirlpool_close(b,a) +#endif + +#ifdef _OPENMP +#include +#endif + +#include "dynamic_types.h" + +#define m_count m_Dynamic_Count +extern int m_count; + +#define eLargeOut dyna_eLargeOut +extern eLargeOut_t *eLargeOut; + +extern MD5_OUT *crypt_key_X86; +extern MD5_OUT *crypt_key2_X86; +extern MD5_IN *input_buf_X86; +extern MD5_IN *input_buf2_X86; +extern unsigned int *total_len_X86; +extern unsigned int *total_len2_X86; + +extern const char *dynamic_itoa16; + +#define curdat Dynamic_curdat +extern private_subformat_data curdat; + +static inline void eLargeOut_set(eLargeOut_t what, int tid) { + eLargeOut[tid] = what; +} +static inline int eLargeOut_get(int tid) { + return eLargeOut[tid]; +} + +#if !defined (_OPENMP) +#define eLargeOut_set(what, tid) eLargeOut_set(what, 0) +#define eLargeOut_get(tid) eLargeOut_get(0) +#endif + +/* These SIMPLE setter functions, change how the large hash output format is performed */ +/* Once set, it stays that way, until set a different way. By DEFAULT (i.e. it is reset */ +/* this way each time), when crypt_all is called, the large output is in eBase16 mode */ +// These MIGHT have problems in _OPENMP builds!! +void DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMS) { + eLargeOut_set(eBase16,tid); +} +void DynamicFunc__LargeHash_OUTMode_base16u(DYNA_OMP_PARAMS) { + eLargeOut_set(eBase16u,tid); +} +void DynamicFunc__LargeHash_OUTMode_base64(DYNA_OMP_PARAMS) { + eLargeOut_set(eBase64,tid); +} +void DynamicFunc__LargeHash_OUTMode_base64_nte(DYNA_OMP_PARAMS) { + eLargeOut_set(eBase64_nte,tid); +} +void DynamicFunc__LargeHash_OUTMode_raw(DYNA_OMP_PARAMS) { + eLargeOut_set(eBaseRaw,tid); +} + +/****************************************************************************** + ***** These helper functions are used by all of the 'LARGE' hash functions. + ***** These are used to convert an 'out' into the proper format, and writing + ***** it to the buffer. Currently we handle base-16, base-16u, base-64 and + ***** raw buffer writting. These functions do not return any count of bytes + ***** nor deal with things like overwrite/appending. That has to be done in + ***** the calling function. The caller will get the pointers setup, then call + ***** these helpers. Then the caller will update any length values if needed + ***** based upon what the output pointer was, and what was returned by these + ***** helpers. Doing things like this will reduce the size of the large hash + ***** primative functions. + ******************************************************************************/ +// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer +static inline unsigned char *hex_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { + int j; + for (j = 0; j < in_byte_cnt; ++j) { + *cpo++ = dynamic_itoa16[*cpi>>4]; + *cpo++ = dynamic_itoa16[*cpi&0xF]; + ++cpi; + } + *cpo = 0; + return cpo; // returns pointer TO the null byte, not past it. +} +// NOTE, cpo must be at least in_byte_cnt*2 bytes of buffer +static inline unsigned char *hex_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { + int j; + for (j = 0; j < in_byte_cnt; ++j) { + *cpo++ = dynamic_itoa16[*cpi>>4]; + *cpo++ = dynamic_itoa16[*cpi&0xF]; + ++cpi; + } + return cpo; +} +// NOTE, cpo must be at least in_byte_cnt*2 bytes of buffer +static inline unsigned char *hexu_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { + int j; + for (j = 0; j < in_byte_cnt; ++j) { + //*cpo++ = dynamic_itoa16[*cpi>>4]; + //*cpo++ = dynamic_itoa16[*cpi&0xF]; + *cpo++ = itoa16u[*cpi>>4]; + *cpo++ = itoa16u[*cpi&0xF]; + ++cpi; + } + return cpo; +} +// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer +static inline unsigned char *hexu_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { + cpo = hexu_out_buf_no_null(cpi, cpo, in_byte_cnt); + *cpo = 0; + return cpo; // returns pointer TO the null byte, not past it. +} + +// NOTE, cpo must be at least in_byte_cnt bytes of buffer +static inline unsigned char *raw_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { + int j; + for (j = 0; j < in_byte_cnt; ++j) { + *cpo++ = *cpi++; + } + return cpo; +} + +// compatible 'standard' MIME base-64 encoding. +static inline unsigned char *base64_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int add_eq) { + static char *_itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + while (in_byte_cnt > 2) { + *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; + *cpo++ = _itoa64[((cpi[0] & 0x03) << 4) + ((cpi[1] & 0xf0) >> 4)]; + *cpo++ = _itoa64[((cpi[1] & 0x0f) << 2) + ((cpi[2] & 0xc0) >> 6)]; + *cpo++ = _itoa64[cpi[2] & 0x3f]; + cpi += 3; + in_byte_cnt -= 3; + } + // easiest way is to simply have 2 'special' cases to handle these lengths + if (in_byte_cnt==2) + { + *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; + *cpo++ = _itoa64[((cpi[0] & 0x03) << 4) + ((cpi[1] & 0xf0) >> 4)]; + *cpo++ = _itoa64[((cpi[1] & 0x0f) << 2)]; + if (add_eq) *cpo++ = '='; + } + if (in_byte_cnt==1) + { + *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; + *cpo++ = _itoa64[((cpi[0] & 0x03) << 4)]; + if (add_eq) { *cpo++ = '='; *cpo++ = '='; } + } + return cpo; +} + +// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer +static inline unsigned char *base64_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int add_eq) { + cpo = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, add_eq); + *cpo = 0; + return cpo; // returns pointer TO the null byte, not past it. +} +#if 0 +void TEST_MIME_crap() { + SHA_CTX ctx1; + MD5_CTX ctx; + SHA256_CTX ctx256; + SHA512_CTX ctx512; + unsigned char Data[64], Res[128]; + char *pw="password"; + + printf ("pw = %s\n", pw); + + SHA384_Init(&ctx512); SHA384_Update(&ctx512, pw, strlen(pw)); SHA384_Final(Data, &ctx512); + hex_out_buf(Data, Res, 48); + printf ("\nSHA384 data:\nb16=%s\n", Res); + base64_out_buf(Data, Res, 48); + printf ("b64=%s\n", Res); + + SHA224_Init(&ctx256); SHA224_Update(&ctx256, pw, strlen(pw)); SHA224_Final(Data, &ctx256); + hex_out_buf(Data, Res, 28); + printf ("\nSHA224 data:\nb16=%s\n", Res); + base64_out_buf(Data, Res, 28); + printf ("b64=%s\n", Res); + + SHA1_Init(&ctx1); SHA1_Update(&ctx1, pw, strlen(pw)); SHA1_Final(Data, &ctx1); + hex_out_buf(Data, Res, 20); + printf ("\nSHA1 data:\nb16=%s\n", Res); + base64_out_buf(Data, Res, 20); + printf ("b64=%s\n", Res); + + MD5_Init(&ctx); MD5_Update(&ctx, pw, strlen(pw)); MD5_Final(Data, &ctx); + hex_out_buf(Data, Res, 16); + printf ("\nMD5 data:\nb16=%s\n", Res); + base64_out_buf(Data, Res, 16); + printf ("b64=%s\n", Res); + + base64_out_buf(Data, Res, 15); + printf ("\n15 byte MD5 base-16 (should be no trailing ==\nb64=%s\n", Res); + + exit(0); + +} +#endif + +int large_hash_output(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid) { + unsigned char *cpo2=cpo; + switch(eLargeOut_get(tid)) { + case eBase16: + cpo2 = hex_out_buf(cpi, cpo, in_byte_cnt); + break; + case eBase16u: + cpo2 = hexu_out_buf(cpi, cpo, in_byte_cnt); + break; + case eBase64: + cpo2 = base64_out_buf(cpi, cpo, in_byte_cnt, 1); + break; + case eBase64_nte: + cpo2 = base64_out_buf(cpi, cpo, in_byte_cnt, 0); + break; + case eBaseRaw: + cpo2 = raw_out_buf(cpi, cpo, in_byte_cnt); + break; + case eUNK: + default: + exit(fprintf(stderr, "Error, unknown 'output' state found in large_hash_output function, in %s\n", curdat.dynamic_WHICH_TYPE_SIG)); + } + return cpo2-cpo; +} +int large_hash_output_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid) { + unsigned char *cpo2=cpo; + switch(eLargeOut_get(tid)) { + case eBase16: + cpo2 = hex_out_buf_no_null(cpi, cpo, in_byte_cnt); + break; + case eBase16u: + cpo2 = hexu_out_buf_no_null(cpi, cpo, in_byte_cnt); + break; + case eBase64: + cpo2 = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, 1); + break; + case eBase64_nte: + cpo2 = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, 0); + break; + case eBaseRaw: + cpo2 = raw_out_buf(cpi, cpo, in_byte_cnt); + break; + case eUNK: + default: + exit(fprintf(stderr, "Error, unknown 'output' state found in large_hash_output function, in %s\n", curdat.dynamic_WHICH_TYPE_SIG)); + } + return cpo2-cpo; +} + + +/******************************************************************** + **** Here are the SHA224 and SHA256 functions!!! + *******************************************************************/ +void DynamicFunc__SHA224_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); + } + else +#endif + { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); + } + SHA224_Final(crypt_out, &ctx); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); + } + else +#endif + { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); + } + SHA256_Final(crypt_out, &ctx); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + SHA224_Final(crypt_out, &ctx); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + SHA256_Final(crypt_out, &ctx); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA224_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA256_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA224_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA256_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA224_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA256_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA224_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); + } +} +void DynamicFunc__SHA256_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA256_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__SHA224_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + else +#endif + SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + SHA224_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 28 bytes. Thus we do not have + // the entire SHA224. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA224 hash (vs the whole 224 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 28). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA256_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + else +#endif + SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + SHA256_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire SHA256. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA256 hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA224_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA224_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + else +#endif + SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + SHA224_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 28 bytes. Thus we do not have + // the entire SHA224. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA224 hash (vs the whole 224 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 28). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA256_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA256_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA256_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + else +#endif + SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + SHA256_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire SHA256. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA256 hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} + +/******************************************************************** + **** Here are the SHA384 and SHA512 functions!!! + *******************************************************************/ +void DynamicFunc__SHA384_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); + } + else +#endif + { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); + } + SHA384_Final(crypt_out, &ctx); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); + } + else +#endif + { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); + } + SHA512_Final(crypt_out, &ctx); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + SHA384_Final(crypt_out, &ctx); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + SHA512_Final(crypt_out, &ctx); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA384_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA512_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA384_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA512_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA384_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + SHA512_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[56]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA384_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); + } +} +void DynamicFunc__SHA512_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + SHA512_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__SHA384_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + else +#endif + SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + SHA384_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 28 bytes. Thus we do not have + // the entire SHA384. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA384 hash (vs the whole 384 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 28). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA512_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); + else +#endif + SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); + SHA512_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire SHA512. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA512 hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA384_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA384_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + else +#endif + SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + SHA384_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 28 bytes. Thus we do not have + // the entire SHA384. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA384 hash (vs the whole 384 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 28). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} +void DynamicFunc__SHA512_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + SHA512_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + SHA512_Init(&ctx); +#if (MD5_X2) + if (i & 1) + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); + else +#endif + SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); + SHA512_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire SHA512. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of SHA512 hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); + } +} + +/************************************************************** + ** GOST functions for dynamic + *************************************************************/ + +void DynamicFunc__GOST_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.B2[total_len2_X86[i]]); + } + else +#endif + { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); + } + john_gost_final(&ctx, crypt_out); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + john_gost_final(&ctx, crypt_out); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + john_gost_final(&ctx, crypt_out); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + john_gost_final(&ctx, crypt_out); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + john_gost_final(&ctx, crypt_out); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + john_gost_final(&ctx, crypt_out); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); + } +} +void DynamicFunc__GOST_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + else +#endif + john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + john_gost_final(&ctx, crypt_out); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire GOST. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of GOST hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} +void DynamicFunc__GOST_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + gost_ctx ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + john_gost_init(&ctx); +#if (MD5_X2) + if (i & 1) + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + else +#endif + john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + john_gost_final(&ctx, crypt_out); + + // Only copies the first 16 out of 32 bytes. Thus we do not have + // the entire GOST. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of GOST hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 32). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} + + +/************************************************************** + ** WHIRLPOOL functions for dynamic + *************************************************************/ +void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.B2[total_len2_X86[i]]); + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + WHIRLPOOL_Final(crypt_out, &ctx); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + else +#endif + WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + WHIRLPOOL_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 64 bytes. Thus we do not have + // the entire WHIRLPOOL. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of WHIRLPOOL hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 64). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + WHIRLPOOL_CTX ctx; + +#ifdef _OPENMP + til = last; + i = first; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + WHIRLPOOL_Init(&ctx); +#if (MD5_X2) + if (i & 1) + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + else +#endif + WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + WHIRLPOOL_Final(crypt_out, &ctx); + + // Only copies the first 16 out of 64 bytes. Thus we do not have + // the entire WHIRLPOOL. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of WHIRLPOOL hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 64). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} + + + +/************************************************************** + ** Tiger functions for dynamic + *************************************************************/ +void DynamicFunc__Tiger_crypt_input1_append_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.B2[total_len2_X86[i]]); + } + else +#endif + { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); + } + sph_tiger_close(&ctx, crypt_out); + total_len2_X86[i] += large_hash_output(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input2_append_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); + } + else +#endif + { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); + } + sph_tiger_close(&ctx, crypt_out); + total_len_X86[i] += large_hash_output(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + sph_tiger_close(&ctx, crypt_out); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + sph_tiger_close(&ctx, crypt_out); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; + } + sph_tiger_close(&ctx, crypt_out); + total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + int tid=0; + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; + } + else +#endif + { + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; + } + sph_tiger_close(&ctx, crypt_out); + total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 24, tid); + } +} +void DynamicFunc__Tiger_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + i = first; + til = last; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); + else +#endif + sph_tiger(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); + sph_tiger_close(&ctx, crypt_out); + + // Only copies the first 16 out of 24 bytes. Thus we do not have + // the entire Tiger. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of Tiger hash (vs the whole 192 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 24). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} +void DynamicFunc__Tiger_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) { + union xx { unsigned char u[24]; ARCH_WORD a[24/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i, til; + sph_tiger_context ctx; + +#ifdef _OPENMP + til = last; + i = first; +#else + i = 0; + til = m_count; +#endif + for (; i < til; ++i) { + sph_tiger_init(&ctx); +#if (MD5_X2) + if (i & 1) + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); + else +#endif + sph_tiger(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); + sph_tiger_close(&ctx, crypt_out); + + // Only copies the first 16 out of 24 bytes. Thus we do not have + // the entire Tiger. It would NOT be valid to continue from here. However + // it is valid (and 128 bit safe), to simply check the first 128 bits + // of Tiger hash (vs the whole 192 bits), with cmp_all/cmp_one, and if it + // matches, then we can 'assume' we have a hit. + // That is why the name of the function is *_FINAL() it is meant to be + // something like sha1(md5($p)) and then we simply compare 16 bytes + // of hash (instead of the full 24). +#if (MD5_X2) + if (i & 1) + memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); + else +#endif + memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); + } +} diff -urpN memdbg2/src/dynamic_fmt.c memdbg1/src/dynamic_fmt.c --- memdbg2/src/dynamic_fmt.c 2013-05-13 08:56:40.968750000 -0500 +++ memdbg1/src/dynamic_fmt.c 2013-05-13 08:30:11.250000000 -0500 @@ -15,7 +15,7 @@ * Renamed and changed from md5_gen* to dynamic*. We handle MD5 and SHA1 * at the present time. More crypt types 'may' be added later. * Added SHA2 (SHA224, SHA256, SHA384, SHA512), GOST, Whirlpool crypt types. - * Whirlpool only if OPENSSL_VERSION_NUMBER >= 0x10000000 + * Whirlpool use oSSSL if OPENSSL_VERSION_NUMBER >= 0x10000000, otherwise use sph_* code. * * There used to be a todo list, and other commenting here. It has been * moved to ./docs/dynamic_history.txt @@ -69,7 +69,6 @@ ahead of time. #include "options.h" #include "config.h" #include "sha.h" -#include "sha2.h" #include "gost.h" #include "memory.h" #include "unicode.h" @@ -82,10 +81,6 @@ ahead of time. static int m_ompt; #endif -#if OPENSSL_VERSION_NUMBER >= 0x10000000 -#include "openssl/whrlpool.h" -#endif - #ifdef MMX_COEF #include "sse-intrinsics.h" #endif @@ -103,8 +98,8 @@ static int nFmts; static int force_md5_ctx; static void dynamic_RESET(struct fmt_main *fmt); -typedef enum { eUNK=0, eBase16=1, eBase16u=2, eBase64=3, eBase64_nte=4, eBaseRaw=5} eLargeOut_t; -static eLargeOut_t *eLargeOut; +#define eLargeOut dyna_eLargeOut +eLargeOut_t *eLargeOut; #if ARCH_LITTLE_ENDIAN @@ -222,12 +217,12 @@ static unsigned int *total_len2; #define FLAT_INP_BUF_SZ (sizeof(MD5_IN)*(MAX_KEYS_PER_CRYPT_X86>>MD5_X2)) #define FLAT_TOT_LEN_SZ (sizeof(unsigned int)*(MAX_KEYS_PER_CRYPT_X86)) -static MD5_OUT *crypt_key_X86; -static MD5_OUT *crypt_key2_X86; -static MD5_IN *input_buf_X86; -static MD5_IN *input_buf2_X86; -static unsigned int *total_len_X86; -static unsigned int *total_len2_X86; +MD5_OUT *crypt_key_X86; +MD5_OUT *crypt_key2_X86; +MD5_IN *input_buf_X86; +MD5_IN *input_buf2_X86; +unsigned int *total_len_X86; +unsigned int *total_len2_X86; static int keys_dirty; // We store the salt here @@ -246,7 +241,7 @@ static int usernamelen; static unsigned char *flds[10]; static int fld_lens[10]; -static const char *dynamic_itoa16 = itoa16; +const char *dynamic_itoa16 = itoa16; static unsigned short itoa16_w2_u[256], itoa16_w2_l[256], *itoa16_w2=itoa16_w2_l; // array of the keys. Also lengths of the keys. NOTE if store_keys_in_input, then the @@ -269,7 +264,8 @@ static char out[EFFECTIVE_MAX_LENGTH + 1 // This is the GLOBAL count of keys. ALL of the primitives which deal with a count // will read from this variable. -static int m_count; +#define m_count m_Dynamic_Count +int m_count; // If we are run in 'specific' mode (say, -format=dynamic -subformat=dynamic_0, then we // want to 'allow' raw hashes to be 'valid'. This is how we will do this. We have a boolean @@ -286,7 +282,8 @@ static int dynamic_use_sse; // If set to 1, then do unicode conversion is many string setting functions. static int *md5_unicode_convert; -static private_subformat_data curdat; +#define curdat Dynamic_curdat +private_subformat_data curdat; // Helper function that loads out 256 unsigned short array that does base-16 conversions // This function is called at the 'validation' call that loads our preloads (i.e. only @@ -442,6 +439,8 @@ static int valid(char *ciphertext, struc cipherTextLen = 96; } else if (pPriv->dynamic_128_byte_sha512 || pPriv->dynamic_128_byte_whirlpool) { cipherTextLen = 128; + } else if (pPriv->dynamic_48_byte_tiger) { + cipherTextLen = 48; } for (i = 0; i < cipherTextLen; i++) { if (atoi16[ARCH_INDEX(cp[i])] == 0x7f) @@ -563,12 +562,6 @@ static inline void __nonMP_DynamicFunc__ #endif } -static inline void eLargeOut_set(eLargeOut_t what, int tid) { - eLargeOut[tid] = what; -} -static inline int eLargeOut_get(int tid) { - return eLargeOut[tid]; -} void __nonMP_eLargeOut(eLargeOut_t what) { #ifdef _OPENMP int i; @@ -7068,223 +7061,18 @@ void DynamicFunc__GOST_crypt_input1_over void DynamicFunc__GOST_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__GOST_crypt_input2_overwrite_input2(DYNA_OMP_PARAMSd); } void DynamicFunc__GOST_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__GOST_crypt_input1_overwrite_input2(DYNA_OMP_PARAMSd); } void DynamicFunc__GOST_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__GOST_crypt_input2_overwrite_input1(DYNA_OMP_PARAMSd); } -#if OPENSSL_VERSION_NUMBER >= 0x10000000 void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input1_append_input2(DYNA_OMP_PARAMSd); } void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input2_append_input1(DYNA_OMP_PARAMSd); } void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1(DYNA_OMP_PARAMSd); } void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2(DYNA_OMP_PARAMSd); } void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2(DYNA_OMP_PARAMSd); } void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1(DYNA_OMP_PARAMSd); } -#endif - -/* These SIMPLE setter functions, change how the large hash output format is performed */ -/* Once set, it stays that way, until set a different way. By DEFAULT (i.e. it is reset */ -/* this way each time), when crypt_all is called, the large output is in eBase16 mode */ -// These MIGHT have problems in _OPENMP builds!! -void DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMS) { - eLargeOut_set(eBase16,tid); -} -void DynamicFunc__LargeHash_OUTMode_base16u(DYNA_OMP_PARAMS) { - eLargeOut_set(eBase16u,tid); -} -void DynamicFunc__LargeHash_OUTMode_base64(DYNA_OMP_PARAMS) { - eLargeOut_set(eBase64,tid); -} -void DynamicFunc__LargeHash_OUTMode_base64_nte(DYNA_OMP_PARAMS) { - eLargeOut_set(eBase64_nte,tid); -} -void DynamicFunc__LargeHash_OUTMode_raw(DYNA_OMP_PARAMS) { - eLargeOut_set(eBaseRaw,tid); -} - - -/****************************************************************************** - ***** These helper functions are used by all of the 'LARGE' hash functions. - ***** These are used to convert an 'out' into the proper format, and writing - ***** it to the buffer. Currently we handle base-16, base-16u, base-64 and - ***** raw buffer writting. These functions do not return any count of bytes - ***** nor deal with things like overwrite/appending. That has to be done in - ***** the calling function. The caller will get the pointers setup, then call - ***** these helpers. Then the caller will update any length values if needed - ***** based upon what the output pointer was, and what was returned by these - ***** helpers. Doing things like this will reduce the size of the large hash - ***** primative functions. - ******************************************************************************/ -// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer -static inline unsigned char *hex_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { - int j; - for (j = 0; j < in_byte_cnt; ++j) { - *cpo++ = dynamic_itoa16[*cpi>>4]; - *cpo++ = dynamic_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - return cpo; // returns pointer TO the null byte, not past it. -} -// NOTE, cpo must be at least in_byte_cnt*2 bytes of buffer -static inline unsigned char *hex_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { - int j; - for (j = 0; j < in_byte_cnt; ++j) { - *cpo++ = dynamic_itoa16[*cpi>>4]; - *cpo++ = dynamic_itoa16[*cpi&0xF]; - ++cpi; - } - return cpo; -} -// NOTE, cpo must be at least in_byte_cnt*2 bytes of buffer -static inline unsigned char *hexu_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { - int j; - for (j = 0; j < in_byte_cnt; ++j) { - //*cpo++ = dynamic_itoa16[*cpi>>4]; - //*cpo++ = dynamic_itoa16[*cpi&0xF]; - *cpo++ = itoa16u[*cpi>>4]; - *cpo++ = itoa16u[*cpi&0xF]; - ++cpi; - } - return cpo; -} -// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer -static inline unsigned char *hexu_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { - cpo = hexu_out_buf_no_null(cpi, cpo, in_byte_cnt); - *cpo = 0; - return cpo; // returns pointer TO the null byte, not past it. -} - -// NOTE, cpo must be at least in_byte_cnt bytes of buffer -static inline unsigned char *raw_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt) { - int j; - for (j = 0; j < in_byte_cnt; ++j) { - *cpo++ = *cpi++; - } - return cpo; -} - -// compatible 'standard' MIME base-64 encoding. -static inline unsigned char *base64_out_buf_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int add_eq) { - static char *_itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - while (in_byte_cnt > 2) { - *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; - *cpo++ = _itoa64[((cpi[0] & 0x03) << 4) + ((cpi[1] & 0xf0) >> 4)]; - *cpo++ = _itoa64[((cpi[1] & 0x0f) << 2) + ((cpi[2] & 0xc0) >> 6)]; - *cpo++ = _itoa64[cpi[2] & 0x3f]; - cpi += 3; - in_byte_cnt -= 3; - } - // easiest way is to simply have 2 'special' cases to handle these lengths - if (in_byte_cnt==2) - { - *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; - *cpo++ = _itoa64[((cpi[0] & 0x03) << 4) + ((cpi[1] & 0xf0) >> 4)]; - *cpo++ = _itoa64[((cpi[1] & 0x0f) << 2)]; - if (add_eq) *cpo++ = '='; - } - if (in_byte_cnt==1) - { - *cpo++ = _itoa64[(cpi[0] & 0xfc) >> 2]; - *cpo++ = _itoa64[((cpi[0] & 0x03) << 4)]; - if (add_eq) { *cpo++ = '='; *cpo++ = '='; } - } - return cpo; -} - -// NOTE, cpo must be at least in_byte_cnt*2+1 bytes of buffer -static inline unsigned char *base64_out_buf(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int add_eq) { - cpo = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, add_eq); - *cpo = 0; - return cpo; // returns pointer TO the null byte, not past it. -} -#if 0 -void TEST_MIME_crap() { - SHA_CTX ctx1; - MD5_CTX ctx; - SHA256_CTX ctx256; - SHA512_CTX ctx512; - unsigned char Data[64], Res[128]; - char *pw="password"; - - printf ("pw = %s\n", pw); - - SHA384_Init(&ctx512); SHA384_Update(&ctx512, pw, strlen(pw)); SHA384_Final(Data, &ctx512); - hex_out_buf(Data, Res, 48); - printf ("\nSHA384 data:\nb16=%s\n", Res); - base64_out_buf(Data, Res, 48); - printf ("b64=%s\n", Res); - - SHA224_Init(&ctx256); SHA224_Update(&ctx256, pw, strlen(pw)); SHA224_Final(Data, &ctx256); - hex_out_buf(Data, Res, 28); - printf ("\nSHA224 data:\nb16=%s\n", Res); - base64_out_buf(Data, Res, 28); - printf ("b64=%s\n", Res); - - SHA1_Init(&ctx1); SHA1_Update(&ctx1, pw, strlen(pw)); SHA1_Final(Data, &ctx1); - hex_out_buf(Data, Res, 20); - printf ("\nSHA1 data:\nb16=%s\n", Res); - base64_out_buf(Data, Res, 20); - printf ("b64=%s\n", Res); - - MD5_Init(&ctx); MD5_Update(&ctx, pw, strlen(pw)); MD5_Final(Data, &ctx); - hex_out_buf(Data, Res, 16); - printf ("\nMD5 data:\nb16=%s\n", Res); - base64_out_buf(Data, Res, 16); - printf ("b64=%s\n", Res); - - base64_out_buf(Data, Res, 15); - printf ("\n15 byte MD5 base-16 (should be no trailing ==\nb64=%s\n", Res); - - exit(0); - -} -#endif - -static inline int large_hash_output(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid) { - unsigned char *cpo2=cpo; - switch(eLargeOut_get(tid)) { - case eBase16: - cpo2 = hex_out_buf(cpi, cpo, in_byte_cnt); - break; - case eBase16u: - cpo2 = hexu_out_buf(cpi, cpo, in_byte_cnt); - break; - case eBase64: - cpo2 = base64_out_buf(cpi, cpo, in_byte_cnt, 1); - break; - case eBase64_nte: - cpo2 = base64_out_buf(cpi, cpo, in_byte_cnt, 0); - break; - case eBaseRaw: - cpo2 = raw_out_buf(cpi, cpo, in_byte_cnt); - break; - case eUNK: - default: - exit(fprintf(stderr, "Error, unknown 'output' state found in large_hash_output function, in %s\n", curdat.dynamic_WHICH_TYPE_SIG)); - } - return cpo2-cpo; -} -static inline int large_hash_output_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid) { - unsigned char *cpo2=cpo; - switch(eLargeOut_get(tid)) { - case eBase16: - cpo2 = hex_out_buf_no_null(cpi, cpo, in_byte_cnt); - break; - case eBase16u: - cpo2 = hexu_out_buf_no_null(cpi, cpo, in_byte_cnt); - break; - case eBase64: - cpo2 = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, 1); - break; - case eBase64_nte: - cpo2 = base64_out_buf_no_null(cpi, cpo, in_byte_cnt, 0); - break; - case eBaseRaw: - cpo2 = raw_out_buf(cpi, cpo, in_byte_cnt); - break; - case eUNK: - default: - exit(fprintf(stderr, "Error, unknown 'output' state found in large_hash_output function, in %s\n", curdat.dynamic_WHICH_TYPE_SIG)); - } - return cpo2-cpo; -} +void DynamicFunc__Tiger_crypt_input1_append_input2_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input1_append_input2(DYNA_OMP_PARAMSd); } +void DynamicFunc__Tiger_crypt_input2_append_input1_base16(DYNA_OMP_PARAMS) { DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input2_append_input1(DYNA_OMP_PARAMSd); } +void DynamicFunc__Tiger_crypt_input1_overwrite_input1_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input1_overwrite_input1(DYNA_OMP_PARAMSd); } +void DynamicFunc__Tiger_crypt_input2_overwrite_input2_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input2_overwrite_input2(DYNA_OMP_PARAMSd); } +void DynamicFunc__Tiger_crypt_input1_overwrite_input2_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input1_overwrite_input2(DYNA_OMP_PARAMSd); } +void DynamicFunc__Tiger_crypt_input2_overwrite_input1_base16(DYNA_OMP_PARAMS){ DynamicFunc__LargeHash_OUTMode_base16(DYNA_OMP_PARAMSd); DynamicFunc__Tiger_crypt_input2_overwrite_input1(DYNA_OMP_PARAMSd); } /************************************************************** ************************************************************** @@ -7797,1674 +7585,71 @@ void DynamicFunc__SHA1_crypt_input2_to_o } } -/******************************************************************** - **** Here are the SHA224 and SHA256 functions!!! - *******************************************************************/ -void DynamicFunc__SHA224_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; +/************************************************************** + * DEPRICATED functions. These are the older pseudo functions + * which we now have flags for. We keep them, so that we can + * add the proper flags, even if the user is running an older + * script. + *************************************************************/ +void DynamicFunc__PHPassSetup(DYNA_OMP_PARAMS) {} +void DynamicFunc__InitialLoadKeysToInput(DYNA_OMP_PARAMS) {} +void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2(DYNA_OMP_PARAMS) {} +void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1(DYNA_OMP_PARAMS) {} +void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1_offset32(DYNA_OMP_PARAMS) {} -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); - } - else -#endif - { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); - } - SHA224_Final(crypt_out, &ctx); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); - } - else -#endif - { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); - } - SHA256_Final(crypt_out, &ctx); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; +/************************************************************** + ************************************************************** + ************************************************************** + ************************************************************** + * DYNAMIC primitive helper function + * This is the END of the primitives. + ************************************************************** + ************************************************************** + ************************************************************** + *************************************************************/ -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else -#endif - { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - SHA224_Final(crypt_out, &ctx); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; +static DYNAMIC_primitive_funcp *ConvertFuncs(DYNAMIC_primitive_funcp p, int *count) +{ + static DYNAMIC_primitive_funcp fncs[20]; + *count = 0; + if (p==DynamicFunc__PHPassSetup || + p==DynamicFunc__InitialLoadKeysToInput || + p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2 || + p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1 || + p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1_offset32) + return fncs; // ignore these -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else +#ifndef MMX_COEF + if (p==DynamicFunc__SSEtoX86_switch_input1 || p==DynamicFunc__SSEtoX86_switch_input2 || + p==DynamicFunc__SSEtoX86_switch_output1 || p==DynamicFunc__SSEtoX86_switch_output2 || + p==DynamicFunc__X86toSSE_switch_input1 || p==DynamicFunc__X86toSSE_switch_input2 || + p==DynamicFunc__X86toSSE_switch_output1 || p==DynamicFunc__X86toSSE_switch_output2 || + p==DynamicFunc__ToSSE || p==DynamicFunc__ToX86) + return fncs; // we ignore these functions 100% in x86 mode. #endif - { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - SHA256_Final(crypt_out, &ctx); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; +// if (p==DynamicFunc__append_input2_from_CONST1) { +// fncs[0] = DynamicFunc__set_input2; +// fncs[1] = DynamicFunc__set_CONST1; +// fncs[2] = DynamicFunc__append_CONST; +// *count = 3; +// } -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else +#if !ARCH_LITTLE_ENDIAN + if (p==DynamicFunc__SHA1_crypt_input1_append_input2_base16 || p==DynamicFunc__SHA1_crypt_input1_append_input2 || + p==DynamicFunc__SHA1_crypt_input2_append_input1_base16 || p==DynamicFunc__SHA1_crypt_input2_append_input1 || + p==DynamicFunc__SHA1_crypt_input1_overwrite_input1_base16 || p==DynamicFunc__SHA1_crypt_input1_overwrite_input1 || + p==DynamicFunc__SHA1_crypt_input2_overwrite_input2_base16 || p==DynamicFunc__SHA1_crypt_input2_overwrite_input2 || + p==DynamicFunc__SHA1_crypt_input1_overwrite_input2_base16 || p==DynamicFunc__SHA1_crypt_input1_overwrite_input2 || + p==DynamicFunc__SHA1_crypt_input2_overwrite_input1_base16 || p==DynamicFunc__SHA1_crypt_input2_overwrite_input1 || + p==DynamicFunc__SHA1_crypt_input1_to_output1_FINAL || + p==DynamicFunc__SHA1_crypt_input2_to_output1_FINAL) + curdat.force_md5_ctx = 0; #endif - { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA224_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA256_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA224_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA256_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA224_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA256_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA224_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 28, tid); - } -} -void DynamicFunc__SHA256_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA256_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__SHA224_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - else -#endif - SHA224_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - SHA224_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 28 bytes. Thus we do not have - // the entire SHA224. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA224 hash (vs the whole 224 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 28). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA256_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - else -#endif - SHA256_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - SHA256_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire SHA256. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA256 hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA224_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA224_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - else -#endif - SHA224_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - SHA224_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 28 bytes. Thus we do not have - // the entire SHA224. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA224 hash (vs the whole 224 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 28). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA256_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA256_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA256_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - else -#endif - SHA256_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - SHA256_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire SHA256. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA256 hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} - -/******************************************************************** - **** Here are the SHA384 and SHA512 functions!!! - *******************************************************************/ -void DynamicFunc__SHA384_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); - } - else -#endif - { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); - } - SHA384_Final(crypt_out, &ctx); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.b2[total_len2_X86[i]]); - } - else -#endif - { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); - } - SHA512_Final(crypt_out, &ctx); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else -#endif - { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - SHA384_Final(crypt_out, &ctx); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else -#endif - { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - SHA512_Final(crypt_out, &ctx); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA384_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA512_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA384_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA512_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA384_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - SHA512_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[56]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA384_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 48, tid); - } -} -void DynamicFunc__SHA512_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - SHA512_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__SHA384_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - else -#endif - SHA384_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - SHA384_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 28 bytes. Thus we do not have - // the entire SHA384. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA384 hash (vs the whole 384 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 28). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA512_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i]); - else -#endif - SHA512_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i]); - SHA512_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire SHA512. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA512 hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA384_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA384_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - else -#endif - SHA384_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - SHA384_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 28 bytes. Thus we do not have - // the entire SHA384. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA384 hash (vs the whole 384 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 28). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} -void DynamicFunc__SHA512_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS){ - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - SHA512_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - SHA512_Init(&ctx); -#if (MD5_X2) - if (i & 1) - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i]); - else -#endif - SHA512_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i]); - SHA512_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire SHA512. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of SHA512 hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.b2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.b, crypt_out, 16); - } -} - -/************************************************************** - ** GOST functions for dynamic - *************************************************************/ - -void DynamicFunc__GOST_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.B2[total_len2_X86[i]]); - } - else -#endif - { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); - } - john_gost_final(&ctx, crypt_out); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else -#endif - { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - john_gost_final(&ctx, crypt_out); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - john_gost_final(&ctx, crypt_out); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - john_gost_final(&ctx, crypt_out); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - john_gost_final(&ctx, crypt_out); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - john_gost_final(&ctx, crypt_out); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 32, tid); - } -} -void DynamicFunc__GOST_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - else -#endif - john_gost_update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - john_gost_final(&ctx, crypt_out); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire GOST. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of GOST hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); - } -} -void DynamicFunc__GOST_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) { - union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - gost_ctx ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - john_gost_init(&ctx); -#if (MD5_X2) - if (i & 1) - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - else -#endif - john_gost_update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - john_gost_final(&ctx, crypt_out); - - // Only copies the first 16 out of 32 bytes. Thus we do not have - // the entire GOST. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of GOST hash (vs the whole 256 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 32). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); - } -} - -/************************************************************** - ** WHIRLPOOL functions for dynamic - *************************************************************/ -#if OPENSSL_VERSION_NUMBER >= 0x10000000 -void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x2.B2[total_len2_X86[i]]); - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len2_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x2.b2[total_len_X86[i]]); - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len_X86[i] += large_hash_output(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len2_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpo; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - int tid=0; - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x2.b2; - } - else -#endif - { - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; - } - WHIRLPOOL_Final(crypt_out, &ctx); - total_len_X86[i] = large_hash_output_no_null(crypt_out, cpo, 64, tid); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - i = first; - til = last; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x2.B2, total_len_X86[i]); - else -#endif - WHIRLPOOL_Update(&ctx, input_buf_X86[i>>MD5_X2].x1.B, total_len_X86[i]); - WHIRLPOOL_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 64 bytes. Thus we do not have - // the entire WHIRLPOOL. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of WHIRLPOOL hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 64). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); - } -} -void DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) { - union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u; - int i, til; - WHIRLPOOL_CTX ctx; - -#ifdef _OPENMP - til = last; - i = first; -#else - i = 0; - til = m_count; -#endif - for (; i < til; ++i) { - WHIRLPOOL_Init(&ctx); -#if (MD5_X2) - if (i & 1) - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x2.B2, total_len2_X86[i]); - else -#endif - WHIRLPOOL_Update(&ctx, input_buf2_X86[i>>MD5_X2].x1.B, total_len2_X86[i]); - WHIRLPOOL_Final(crypt_out, &ctx); - - // Only copies the first 16 out of 64 bytes. Thus we do not have - // the entire WHIRLPOOL. It would NOT be valid to continue from here. However - // it is valid (and 128 bit safe), to simply check the first 128 bits - // of WHIRLPOOL hash (vs the whole 512 bits), with cmp_all/cmp_one, and if it - // matches, then we can 'assume' we have a hit. - // That is why the name of the function is *_FINAL() it is meant to be - // something like sha1(md5($p)) and then we simply compare 16 bytes - // of hash (instead of the full 64). -#if (MD5_X2) - if (i & 1) - memcpy(crypt_key_X86[i>>MD5_X2].x2.B2, crypt_out, 16); - else -#endif - memcpy(crypt_key_X86[i>>MD5_X2].x1.B, crypt_out, 16); - } -} -#endif - -/************************************************************** - * DEPRICATED functions. These are the older pseudo functions - * which we now have flags for. We keep them, so that we can - * add the proper flags, even if the user is running an older - * script. - *************************************************************/ -void DynamicFunc__PHPassSetup(DYNA_OMP_PARAMS) {} -void DynamicFunc__InitialLoadKeysToInput(DYNA_OMP_PARAMS) {} -void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2(DYNA_OMP_PARAMS) {} -void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1(DYNA_OMP_PARAMS) {} -void DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1_offset32(DYNA_OMP_PARAMS) {} - - -/************************************************************** - ************************************************************** - ************************************************************** - ************************************************************** - * DYNAMIC primitive helper function - * This is the END of the primitives. - ************************************************************** - ************************************************************** - ************************************************************** - *************************************************************/ - -static DYNAMIC_primitive_funcp *ConvertFuncs(DYNAMIC_primitive_funcp p, int *count) -{ - static DYNAMIC_primitive_funcp fncs[20]; - *count = 0; - if (p==DynamicFunc__PHPassSetup || - p==DynamicFunc__InitialLoadKeysToInput || - p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2 || - p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1 || - p==DynamicFunc__InitialLoadKeys_md5crypt_ToOutput2_Base16_to_Input1_offset32) - return fncs; // ignore these - -#ifndef MMX_COEF - if (p==DynamicFunc__SSEtoX86_switch_input1 || p==DynamicFunc__SSEtoX86_switch_input2 || - p==DynamicFunc__SSEtoX86_switch_output1 || p==DynamicFunc__SSEtoX86_switch_output2 || - p==DynamicFunc__X86toSSE_switch_input1 || p==DynamicFunc__X86toSSE_switch_input2 || - p==DynamicFunc__X86toSSE_switch_output1 || p==DynamicFunc__X86toSSE_switch_output2 || - p==DynamicFunc__ToSSE || p==DynamicFunc__ToX86) - return fncs; // we ignore these functions 100% in x86 mode. -#endif -// if (p==DynamicFunc__append_input2_from_CONST1) { -// fncs[0] = DynamicFunc__set_input2; -// fncs[1] = DynamicFunc__set_CONST1; -// fncs[2] = DynamicFunc__append_CONST; -// *count = 3; -// } - -#if !ARCH_LITTLE_ENDIAN - if (p==DynamicFunc__SHA1_crypt_input1_append_input2_base16 || p==DynamicFunc__SHA1_crypt_input1_append_input2 || - p==DynamicFunc__SHA1_crypt_input2_append_input1_base16 || p==DynamicFunc__SHA1_crypt_input2_append_input1 || - p==DynamicFunc__SHA1_crypt_input1_overwrite_input1_base16 || p==DynamicFunc__SHA1_crypt_input1_overwrite_input1 || - p==DynamicFunc__SHA1_crypt_input2_overwrite_input2_base16 || p==DynamicFunc__SHA1_crypt_input2_overwrite_input2 || - p==DynamicFunc__SHA1_crypt_input1_overwrite_input2_base16 || p==DynamicFunc__SHA1_crypt_input1_overwrite_input2 || - p==DynamicFunc__SHA1_crypt_input2_overwrite_input1_base16 || p==DynamicFunc__SHA1_crypt_input2_overwrite_input1 || - p==DynamicFunc__SHA1_crypt_input1_to_output1_FINAL || - p==DynamicFunc__SHA1_crypt_input2_to_output1_FINAL) - curdat.force_md5_ctx = 0; -#endif - - *count = 1; - fncs[0] = p; - return fncs; + *count = 1; + fncs[0] = p; + return fncs; } static int isSHA1Func(DYNAMIC_primitive_funcp p) { @@ -9538,8 +7723,20 @@ static int isGOSTFunc(DYNAMIC_primitive_ return 0; } +static int isTigerFunc(DYNAMIC_primitive_funcp p) { + if (p==DynamicFunc__Tiger_crypt_input1_append_input2_base16 || p==DynamicFunc__Tiger_crypt_input1_append_input2 || + p==DynamicFunc__Tiger_crypt_input2_append_input1_base16 || p==DynamicFunc__Tiger_crypt_input2_append_input1 || + p==DynamicFunc__Tiger_crypt_input1_overwrite_input1_base16 || p==DynamicFunc__Tiger_crypt_input1_overwrite_input1 || + p==DynamicFunc__Tiger_crypt_input2_overwrite_input2_base16 || p==DynamicFunc__Tiger_crypt_input2_overwrite_input2 || + p==DynamicFunc__Tiger_crypt_input1_overwrite_input2_base16 || p==DynamicFunc__Tiger_crypt_input1_overwrite_input2 || + p==DynamicFunc__Tiger_crypt_input2_overwrite_input1_base16 || p==DynamicFunc__Tiger_crypt_input2_overwrite_input1 || + p==DynamicFunc__Tiger_crypt_input1_to_output1_FINAL || + p==DynamicFunc__Tiger_crypt_input2_to_output1_FINAL) + return 1; + return 0; +} + static int isWHIRLFunc(DYNAMIC_primitive_funcp p) { -#if OPENSSL_VERSION_NUMBER >= 0x10000000 if (p==DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16 || p==DynamicFunc__WHIRLPOOL_crypt_input1_append_input2 || p==DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16 || p==DynamicFunc__WHIRLPOOL_crypt_input2_append_input1 || p==DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16 || p==DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1 || @@ -9549,7 +7746,6 @@ static int isWHIRLFunc(DYNAMIC_primitive p==DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL || p==DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL) return 1; -#endif return 0; } @@ -9587,6 +7783,7 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, curdat.dynamic_128_byte_sha512= ((Setup->startFlags&MGF_SHA512_128_BYTE_FINISH)==MGF_SHA512_128_BYTE_FINISH) ? 1 : 0; curdat.dynamic_64_byte_gost = ((Setup->startFlags&MGF_GOST_64_BYTE_FINISH)==MGF_GOST_64_BYTE_FINISH) ? 1 : 0; curdat.dynamic_128_byte_whirlpool = ((Setup->startFlags&MGF_WHIRLPOOL_128_BYTE_FINISH)==MGF_WHIRLPOOL_128_BYTE_FINISH) ? 1 : 0; + curdat.dynamic_48_byte_tiger = ((Setup->startFlags&MGF_Tiger_48_BYTE_FINISH)==MGF_Tiger_48_BYTE_FINISH) ? 1 : 0; curdat.FldMask = 0; curdat.b2Salts = ((Setup->flags&MGF_SALTED2)==MGF_SALTED2) ? 1 : 0; @@ -10061,6 +8258,12 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) pFmt->params.algorithm_name = ALGORITHM_NAME_X86_GST2; } + if (isTigerFunc(pFuncs[x])) { + if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME)) + pFmt->params.algorithm_name = ALGORITHM_NAME_TGR; + else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) + pFmt->params.algorithm_name = ALGORITHM_NAME_X86_TGR; + } } if (curdat.dynamic_FUNCTIONS[j-1] == DynamicFunc__SHA1_crypt_input1_to_output1_FINAL || @@ -10182,6 +8385,8 @@ static int LoadOneFormat(int idx, struct curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 96 + 1; else if (curdat.dynamic_128_byte_sha512 || curdat.dynamic_128_byte_whirlpool) curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 128 + 1; + else if (curdat.dynamic_48_byte_tiger) + curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 48 + 1; else curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 32 + 1; diff -urpN memdbg2/src/dynamic_parser.c memdbg1/src/dynamic_parser.c --- memdbg2/src/dynamic_parser.c 2013-05-13 08:56:40.984375000 -0500 +++ memdbg1/src/dynamic_parser.c 2013-05-13 08:15:02.531250000 -0500 @@ -53,7 +53,7 @@ * Renamed and changed from md5_gen* to dynamic*. We handle MD5 and SHA1 * at the present time. More crypt types 'may' be added later. * Added SHA2 (SHA224, SHA256, SHA384, SHA512), GOST, Whirlpool crypt types. - * Whirlpool only if OPENSSL_VERSION_NUMBER >= 0x10000000 + * Whirlpool use oSSSL if OPENSSL_VERSION_NUMBER >= 0x10000000, otherwise use sph_* code. * */ @@ -257,7 +257,6 @@ static Dynamic_Predicate_t Dynamic_Predi { "DynamicFunc__GOST_crypt_input2_overwrite_input1", DynamicFunc__GOST_crypt_input2_overwrite_input1 }, { "DynamicFunc__GOST_crypt_input1_to_output1_FINAL", DynamicFunc__GOST_crypt_input1_to_output1_FINAL }, { "DynamicFunc__GOST_crypt_input2_to_output1_FINAL", DynamicFunc__GOST_crypt_input2_to_output1_FINAL }, -#if OPENSSL_VERSION_NUMBER >= 0x10000000 { "DynamicFunc__WHIRLPOOL_crypt_input1_append_input2", DynamicFunc__WHIRLPOOL_crypt_input1_append_input2 }, { "DynamicFunc__WHIRLPOOL_crypt_input2_append_input1", DynamicFunc__WHIRLPOOL_crypt_input2_append_input1 }, { "DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1", DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1 }, @@ -266,8 +265,14 @@ static Dynamic_Predicate_t Dynamic_Predi { "DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1", DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1 }, { "DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL", DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL }, { "DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL", DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL }, -#endif - + { "DynamicFunc__Tiger_crypt_input1_append_input2", DynamicFunc__Tiger_crypt_input1_append_input2 }, + { "DynamicFunc__Tiger_crypt_input2_append_input1", DynamicFunc__Tiger_crypt_input2_append_input1 }, + { "DynamicFunc__Tiger_crypt_input1_overwrite_input1", DynamicFunc__Tiger_crypt_input1_overwrite_input1 }, + { "DynamicFunc__Tiger_crypt_input2_overwrite_input2", DynamicFunc__Tiger_crypt_input2_overwrite_input2 }, + { "DynamicFunc__Tiger_crypt_input1_overwrite_input2", DynamicFunc__Tiger_crypt_input1_overwrite_input2 }, + { "DynamicFunc__Tiger_crypt_input2_overwrite_input1", DynamicFunc__Tiger_crypt_input2_overwrite_input1 }, + { "DynamicFunc__Tiger_crypt_input1_to_output1_FINAL", DynamicFunc__Tiger_crypt_input1_to_output1_FINAL }, + { "DynamicFunc__Tiger_crypt_input2_to_output1_FINAL", DynamicFunc__Tiger_crypt_input2_to_output1_FINAL }, /* These are now depricated. When we find them, 2 functions get called. The functions HAVE been kept in dynamic_fmt.c, but they are VERY thin */ { "DynamicFunc__SHA1_crypt_input1_append_input2_base16", DynamicFunc__SHA1_crypt_input1_append_input2_base16 }, @@ -306,14 +311,19 @@ static Dynamic_Predicate_t Dynamic_Predi { "DynamicFunc__GOST_crypt_input2_overwrite_input2_base16", DynamicFunc__GOST_crypt_input2_overwrite_input2_base16 }, { "DynamicFunc__GOST_crypt_input1_overwrite_input2_base16", DynamicFunc__GOST_crypt_input1_overwrite_input2_base16 }, { "DynamicFunc__GOST_crypt_input2_overwrite_input1_base16", DynamicFunc__GOST_crypt_input2_overwrite_input1_base16 }, -#if OPENSSL_VERSION_NUMBER >= 0x10000000 { "DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16", DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16 }, { "DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16", DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16 }, { "DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16", DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16 }, { "DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16", DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16 }, { "DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16", DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16 }, { "DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16", DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16 }, -#endif + { "DynamicFunc__Tiger_crypt_input1_append_input2_base16", DynamicFunc__Tiger_crypt_input1_append_input2_base16 }, + { "DynamicFunc__Tiger_crypt_input2_append_input1_base16", DynamicFunc__Tiger_crypt_input2_append_input1_base16 }, + { "DynamicFunc__Tiger_crypt_input1_overwrite_input1_base16", DynamicFunc__Tiger_crypt_input1_overwrite_input1_base16 }, + { "DynamicFunc__Tiger_crypt_input2_overwrite_input2_base16", DynamicFunc__Tiger_crypt_input2_overwrite_input2_base16 }, + { "DynamicFunc__Tiger_crypt_input1_overwrite_input2_base16", DynamicFunc__Tiger_crypt_input1_overwrite_input2_base16 }, + { "DynamicFunc__Tiger_crypt_input2_overwrite_input1_base16", DynamicFunc__Tiger_crypt_input2_overwrite_input1_base16 }, + // Depricated. These are the 'original' md5_gen version. We have changed to using Dynamic_Func__ but still 'parse' // and use the MD5GenBaseFunc__ script files. @@ -488,6 +498,7 @@ static Dynamic_Str_Flag_t Dynamic_Str_sF { "MGF_SHA512_128_BYTE_FINISH", MGF_SHA512_128_BYTE_FINISH }, { "MGF_GOST_64_BYTE_FINISH", MGF_GOST_64_BYTE_FINISH }, { "MGF_WHIRLPOOL_128_BYTE_FINISH", MGF_WHIRLPOOL_128_BYTE_FINISH }, + { "MGF_Tiger_48_BYTE_FINISH", MGF_Tiger_48_BYTE_FINISH }, { NULL, 0 }}; static DYNAMIC_Setup *pSetup; diff -urpN memdbg2/src/dynamic_preloads.c memdbg1/src/dynamic_preloads.c --- memdbg2/src/dynamic_preloads.c 2013-05-13 08:56:40.984375000 -0500 +++ memdbg1/src/dynamic_preloads.c 2013-05-13 08:54:48.281250000 -0500 @@ -20,7 +20,7 @@ * Renamed and changed from md5_gen* to dynamic*. We handle MD5 and SHA1 * at the present time. More crypt types 'may' be added later. * Added SHA2 (SHA224, SHA256, SHA384, SHA512), GOST, Whirlpool crypt types. - * Whirlpool only if OPENSSL_VERSION_NUMBER >= 0x10000000 + * Whirlpool use oSSSL if OPENSSL_VERSION_NUMBER >= 0x10000000, otherwise use sph_* code. */ #include @@ -119,7 +119,7 @@ //dynamic_85 -->sha512(sha512($p).$s) //dynamic_86 -->sha512($s.sha512($p)) //dynamic_87 -->sha512(sha512($s).sha512($p)) - // Try to group GOST here (from dyna-90 to dyna-100) + // Try to group GOST here (from dyna-90 to dyna-99) //dynamic_90 -->GOST($p) //dynamic_91 -->GOST($s.$p) //dynamic_92 -->GOST($p.$s) @@ -128,7 +128,7 @@ //dynamic_95 -->GOST(GOST($p).$s) //dynamic_96 -->GOST($s.GOST($p)) //dynamic_97 -->GOST(GOST($s).GOST($p)) - // Try to group WHIRLPOOL here (from dyna-100 to dyna-110) + // Try to group WHIRLPOOL here (from dyna-100 to dyna-109) //dynamic_100 -->WHIRLPOOL($p) //dynamic_101 -->WHIRLPOOL($s.$p) //dynamic_102 -->WHIRLPOOL($p.$s) @@ -137,6 +137,15 @@ //dynamic_105 -->WHIRLPOOL(WHIRLPOOL($p).$s) //dynamic_106 -->WHIRLPOOL($s.WHIRLPOOL($p)) //dynamic_107 -->WHIRLPOOL(WHIRLPOOL($s).WHIRLPOOL($p)) + // Try to group Tiger here (from dyna-110 to dyna-119) +//dynamic_110 -->Tiger($p) +//dynamic_111 -->Tiger($s.$p) +//dynamic_112 -->Tiger($p.$s) +//dynamic_113 -->Tiger(Tiger($p)) +//dynamic_114 -->Tiger(Tiger_raw($p)) +//dynamic_115 -->Tiger(Tiger($p).$s) +//dynamic_116 -->Tiger($s.Tiger($p)) +//dynamic_117 -->Tiger(Tiger($s).Tiger($p)) static DYNAMIC_primitive_funcp _Funcs_0[] = { @@ -1900,8 +1909,6 @@ static struct fmt_tests _Preloads_97[] = {NULL} }; - -#if OPENSSL_VERSION_NUMBER >= 0x10000000 // dynamic_100: WHIRLPOOL($p) static DYNAMIC_primitive_funcp _Funcs_100[] = { @@ -1959,6 +1966,7 @@ static struct fmt_tests _Preloads_102[] {"$dynamic_102$94bb2261deb52f06034106e7c61fdc121cfedcab468b97683b0baf46a3047b9b3da3440a478a1059b7b95a2206bb2a51d61ccfad6a684f1d44dce2b741ebfa10$xr57dTTr","test3"}, {NULL} }; + // dynamic_103: WHIRLPOOL(WHIRLPOOL($p)) static DYNAMIC_primitive_funcp _Funcs_103[] = { @@ -2063,7 +2071,169 @@ static struct fmt_tests _Preloads_107[] {"$dynamic_107$721808e56a5a0a4111fb4b76652bc6b0a333356915ba50a62b420600a73fe7eb90e6751e3627bef7105a97611da40605d4d4efb6d41e21212cb6c6311a3354a6$FOpkjyZy","test3"}, {NULL} }; -#endif + +// dynamic_110: Tiger($p) +static DYNAMIC_primitive_funcp _Funcs_110[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_keys, + DynamicFunc__Tiger_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_110[] = +{ + {"$dynamic_110$c099bbd00faf33027ab55bfb4c3a67f19ecd8eb950078ed2", "test1"}, + {"$dynamic_110$77a533a29f121450b90ce237856127b2cd47db1359758ee0", "thatsworking"}, + {"$dynamic_110$b8b9f8ab7e7b617abd37e86b89dee671f6332af9a4088497", "test3"}, + {NULL} +}; + +// dynamic_111: Tiger($s.$p) +static DYNAMIC_primitive_funcp _Funcs_111[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_SALTED + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_salt, + DynamicFunc__append_keys, + DynamicFunc__Tiger_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_111[] = +{ + {"$dynamic_111$b9e3062ae9047433b2d8e67fa99860ba7eea616030b7c3cd$KCh80l","test1"}, + {"$dynamic_111$0c35e8a64cd4f421b009582af6e7ecba43f27a0abb1a51f4$mAIaqQ","thatsworking"}, + {"$dynamic_111$c7d22bb594b33730852d4d20836a7b2c543c58979d7d714b$H7SkQK","test3"}, + {NULL} +}; + +// dynamic_112: Tiger($s.$p) +static DYNAMIC_primitive_funcp _Funcs_112[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_SALTED + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_keys, + DynamicFunc__append_salt, + DynamicFunc__Tiger_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_112[] = +{ + {"$dynamic_112$5be18dd441743f2294cb0576e4d1d1cadb45f8851cf0027f$Veo0bpD7","test1"}, + {"$dynamic_112$cca3119c158125bfe4bfc5755d5d10b6b79520b433efbcd4$7j0PHbFb","thatsworking"}, + {"$dynamic_112$b609e4d7c7d59b9e725044319052c959a5642c30b2734709$MCmH3DLI","test3"}, + {NULL} +}; + +// dynamic_113: Tiger(Tiger($p)) +static DYNAMIC_primitive_funcp _Funcs_113[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + //MGF_KEYS_IN_INPUT + + //DynamicFunc__clean_input2, + //DynamicFunc__Tiger_crypt_input1_append_input2, + // both appand and overwrite tested. Since we have a fixed size, overwrite, with no clean2 works fine and faster. + DynamicFunc__Tiger_crypt_input1_overwrite_input2, + + DynamicFunc__Tiger_crypt_input2_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_113[] = +{ + {"$dynamic_113$d9568618c46ab11a6dc07f6c7e6611aaef94f6dfb58de3f9","test1"}, + {"$dynamic_113$23694933d9a32a00bc9383f78d2e2bdeec70a6c82571233e","thatsworking"}, + {"$dynamic_113$bd13e5e842b94a278cd8c0aefb200ccb009ca17e1b3c7754","test3"}, + {NULL} +}; + +// dynamic_114: Tiger(Tiger_raw($p)) +static DYNAMIC_primitive_funcp _Funcs_114[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + //MGF_KEYS_IN_INPUT + DynamicFunc__LargeHash_OUTMode_raw, + DynamicFunc__Tiger_crypt_input1_overwrite_input2, + DynamicFunc__Tiger_crypt_input2_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_114[] = +{ + {"$dynamic_114$49fd56fd6adda42abdf991816189ccbff945a9e9c4201919","test1"}, + {"$dynamic_114$e6797c7981a25e4f5b368f8700d2aea475fd7e90b4265f65","thatsworking"}, + {"$dynamic_114$550590323f8ff9d850c40ff8fe0bd6dc43faf6e65f74fef2","test3"}, + {NULL} +}; + +// dynamic_115: Tiger(Tiger($p).$s) +static DYNAMIC_primitive_funcp _Funcs_115[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + //MGF_SALTED + //MGF_KEYS_IN_INPUT + DynamicFunc__Tiger_crypt_input1_overwrite_input2, + DynamicFunc__append_salt2, + DynamicFunc__Tiger_crypt_input2_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_115[] = +{ + {"$dynamic_115$42f07b536f64106682afa8ab891da84cfadd4d13b1074025$4SLjwS","test1"}, + {"$dynamic_115$9e0124dc691ec243afc62242eced4ebf9242ed0a1fb5a3df$WuotgU","thatsworking"}, + {"$dynamic_115$aa02d0b7d1e599fb280cfb28af9a24c349197fe385e99358$WMPmYO","test3"}, + {NULL} +}; + +// dynamic_116: Tiger($s.Tiger($p)) +static DYNAMIC_primitive_funcp _Funcs_116[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + //MGF_SALTED + //MGF_KEYS_IN_INPUT + DynamicFunc__clean_input2, + DynamicFunc__append_salt2, + DynamicFunc__Tiger_crypt_input1_append_input2, + DynamicFunc__Tiger_crypt_input2_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_116[] = +{ + {"$dynamic_116$949abe42a3fb02f95ea403c216707cb1b0db2e543b094afd$NW4uHL","test1"}, + {"$dynamic_116$433b70b50ea4ea05c1b920e9794f2f1a15b84d65e9997da4$UjuO0F","thatsworking"}, + {"$dynamic_116$e47227d2ad4f85f7064c7fd9dcc476c75c26c9d5d3e3d990$TI2V6w","test3"}, + {NULL} +}; + +// dynamic_117: Tiger(Tiger($s).Tiger($p)) +static DYNAMIC_primitive_funcp _Funcs_117[] = +{ + //MGF_Tiger_48_BYTE_FINISH + //MGF_NOTSSE2Safe + //MGF_SALTED + //MGF_KEYS_IN_INPUT + DynamicFunc__clean_input2, + DynamicFunc__append_salt2, + DynamicFunc__Tiger_crypt_input2_overwrite_input2, + DynamicFunc__Tiger_crypt_input1_append_input2, + DynamicFunc__Tiger_crypt_input2_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_117[] = +{ + {"$dynamic_117$4a3443bc430e461236578b3a6d894543caa11dc67608f5e1$zuvXaO","test1"}, + {"$dynamic_117$c5da7cf68984d2a15bc09c79766d6d0e2715efb6aa9707bd$BhU05y","thatsworking"}, + {"$dynamic_117$137362481b7ace538d52b731564dc23b3ce20d18c985637b$Ozow4i","test3"}, + {NULL} +}; // Here is a 'dummy' constant array. This will be 'linked' to any dynamic format that does not have any constants. static DYNAMIC_Constants _ConstDefault[] = @@ -2175,7 +2345,7 @@ static DYNAMIC_Setup Setups[] = { "dynamic_85: sha512(sha512($p).$s)", _Funcs_85,_Preloads_85,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_SHA512_128_BYTE_FINISH, -20, 35 }, { "dynamic_86: sha512($s.sha512($p))", _Funcs_86,_Preloads_86,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_SHA512_128_BYTE_FINISH, -20, 35 }, { "dynamic_87: sha512(sha512($s).sha512($p))",_Funcs_87,_Preloads_87,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_SHA512_128_BYTE_FINISH, -20, 35 }, - // Try to group GOST here (from dyna-90 to dyna-100) + // Try to group GOST here (from dyna-90 to dyna-99) { "dynamic_90: GOST($p)", _Funcs_90,_Preloads_90,_ConstDefault, MGF_NOTSSE2Safe, MGF_GOST_64_BYTE_FINISH }, { "dynamic_91: GOST($s.$p)", _Funcs_91,_Preloads_91,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_GOST_64_BYTE_FINISH, -20, 35 }, { "dynamic_92: GOST($p.$s)", _Funcs_92,_Preloads_92,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_GOST_64_BYTE_FINISH, -20, 35 }, @@ -2184,8 +2354,7 @@ static DYNAMIC_Setup Setups[] = { "dynamic_95: GOST(GOST($p).$s)", _Funcs_95,_Preloads_95,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_GOST_64_BYTE_FINISH, -20, 35 }, { "dynamic_96: GOST($s.GOST($p))", _Funcs_96,_Preloads_96,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_GOST_64_BYTE_FINISH, -20, 35 }, { "dynamic_97: GOST(GOST($s).GOST($p))", _Funcs_97,_Preloads_97,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_GOST_64_BYTE_FINISH, -20, 35 }, -#if OPENSSL_VERSION_NUMBER >= 0x10000000 - // Try to group WHIRLPOOL here (from dyna-100 to dyna-110) + // Try to group WHIRLPOOL here (from dyna-100 to dyna-109) { "dynamic_100: WHIRLPOOL($p)", _Funcs_100,_Preloads_100,_ConstDefault, MGF_NOTSSE2Safe, MGF_WHIRLPOOL_128_BYTE_FINISH }, { "dynamic_101: WHIRLPOOL($s.$p)", _Funcs_101,_Preloads_101,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_WHIRLPOOL_128_BYTE_FINISH, -20, 35 }, { "dynamic_102: WHIRLPOOL($p.$s)", _Funcs_102,_Preloads_102,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_WHIRLPOOL_128_BYTE_FINISH, -20, 35 }, @@ -2194,7 +2363,15 @@ static DYNAMIC_Setup Setups[] = { "dynamic_105: WHIRLPOOL(WHIRLPOOL($p).$s)",_Funcs_105,_Preloads_105,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_WHIRLPOOL_128_BYTE_FINISH, -20, 35 }, { "dynamic_106: WHIRLPOOL($s.WHIRLPOOL($p))",_Funcs_106,_Preloads_106,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_WHIRLPOOL_128_BYTE_FINISH, -20, 35 }, { "dynamic_107: WHIRLPOOL(WHIRLPOOL($s).WHIRLPOOL($p))",_Funcs_107,_Preloads_107,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_WHIRLPOOL_128_BYTE_FINISH, -20, 35 }, -#endif + // Try to group Tiger here (from dyna-110 to dyna-119) + { "dynamic_110: Tiger($p)", _Funcs_110,_Preloads_110,_ConstDefault, MGF_NOTSSE2Safe, MGF_Tiger_48_BYTE_FINISH }, + { "dynamic_111: Tiger($s.$p)", _Funcs_111,_Preloads_111,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_Tiger_48_BYTE_FINISH, -20, 35 }, + { "dynamic_112: Tiger($p.$s)", _Funcs_112,_Preloads_112,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_Tiger_48_BYTE_FINISH, -20, 35 }, + { "dynamic_113: Tiger(Tiger($p))", _Funcs_113,_Preloads_113,_ConstDefault, MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_Tiger_48_BYTE_FINISH, }, + { "dynamic_114: Tiger(Tiger_raw($p))", _Funcs_114,_Preloads_114,_ConstDefault, MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_Tiger_48_BYTE_FINISH, }, + { "dynamic_115: Tiger(Tiger($p).$s)", _Funcs_115,_Preloads_115,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_Tiger_48_BYTE_FINISH, -20, 35 }, + { "dynamic_116: Tiger($s.Tiger($p))", _Funcs_116,_Preloads_116,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_Tiger_48_BYTE_FINISH, -20, 35 }, + { "dynamic_117: Tiger(Tiger($s).Tiger($p))", _Funcs_117,_Preloads_117,_ConstDefault, MGF_SALTED|MGF_NOTSSE2Safe, MGF_KEYS_INPUT|MGF_Tiger_48_BYTE_FINISH, -20, 35 }, }; char *dynamic_PRELOAD_SIGNATURE(int cnt) diff -urpN memdbg2/src/dynamic_types.h memdbg1/src/dynamic_types.h --- memdbg2/src/dynamic_types.h 2013-05-11 18:28:33.968750000 -0500 +++ memdbg1/src/dynamic_types.h 2013-05-13 08:30:11.234375000 -0500 @@ -118,6 +118,7 @@ typedef struct private_subformat_data int dynamic_128_byte_sha512; int dynamic_64_byte_gost; int dynamic_128_byte_whirlpool; + int dynamic_48_byte_tiger; // Some formats have 'constants'. A good example is the MD5 Post Office format dynamic_18 // There can be 8 constants which can be put into the strings being built. Most formats do @@ -253,8 +254,13 @@ typedef struct private_subformat_data #define ALGORITHM_NAME_X86_S2 ARCH_BITS_STR"/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 sha2-OpenSSL" #endif +#if OPENSSL_VERSION_NUMBER >= 0x10000000 #define ALGORITHM_NAME_WP2 ARCH_BITS_STR"/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 OpenSSL" #define ALGORITHM_NAME_X86_WP2 ARCH_BITS_STR"/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 OpenSSL" +#else +#define ALGORITHM_NAME_WP2 ARCH_BITS_STR"/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 SPH_WP" +#define ALGORITHM_NAME_X86_WP2 ARCH_BITS_STR"/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 SPH_WP" +#endif #if !defined(USE_GCC_ASM_IA32) && defined(USE_GCC_ASM_X64) #define ALGORITHM_NAME_GST2 "64/64 "STRINGIZE(X86_BLOCK_LOOPS) "x1" @@ -264,6 +270,9 @@ typedef struct private_subformat_data #define ALGORITHM_NAME_X86_GST2 "32/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1" #endif +#define ALGORITHM_NAME_TGR "32/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 sph_tiger" +#define ALGORITHM_NAME_X86_TGR "32/"ARCH_BITS_STR" "STRINGIZE(X86_BLOCK_LOOPS) "x1 sph_tiger" + #ifdef USE_MD5_Go #define MIN_KEYS_PER_CRYPT_X86 1 #define MAX_KEYS_PER_CRYPT_X86 X86_BLOCK_LOOPS @@ -350,4 +359,10 @@ extern void MD5_body(MD5_word x[15],MD5_ #endif +extern int large_hash_output(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid); +int large_hash_output_no_null(unsigned char *cpi, unsigned char *cpo, int in_byte_cnt, int tid); + +typedef enum { eUNK=0, eBase16=1, eBase16u=2, eBase64=3, eBase64_nte=4, eBaseRaw=5} eLargeOut_t; + + #endif // __Dynamic_Types__H__ diff -urpN memdbg2/src/dynamic_utils.c memdbg1/src/dynamic_utils.c --- memdbg2/src/dynamic_utils.c 2013-05-11 18:28:33.968750000 -0500 +++ memdbg1/src/dynamic_utils.c 2013-05-12 13:40:31.453125000 -0500 @@ -20,7 +20,7 @@ * Renamed and changed from dynamic* to dynamic*. We handle MD5 and SHA1 * at the present time. More crypt types 'may' be added later. * Added SHA2 (SHA224, SHA256, SHA384, SHA512), GOST, Whirlpool crypt types. - * Whirlpool only if OPENSSL_VERSION_NUMBER >= 0x10000000 + * Whirlpool use oSSSL if OPENSSL_VERSION_NUMBER >= 0x10000000, otherwise use sph_* code. */ #include diff -urpN memdbg2/src/Makefile memdbg1/src/Makefile --- memdbg2/src/Makefile 2013-05-11 18:28:33.140625000 -0500 +++ memdbg1/src/Makefile 2013-05-13 09:11:43.078125000 -0500 @@ -115,7 +115,7 @@ JOHN_OBJS = \ hmacmd5.o \ base64.o \ md4.o sha2.o \ - dynamic_fmt.o dynamic_parser.o dynamic_preloads.o dynamic_utils.o \ + dynamic_fmt.o dynamic_parser.o dynamic_preloads.o dynamic_utils.o dynamic_big_crypt.o \ hmacMD5_fmt.o hmacSHA1_fmt.o \ django_fmt.o \ truecrypt_fmt.o \