diff -urpN jumbo-bleed2/src/cracker.c jumbo-bleed1/src/cracker.c --- jumbo-bleed2/src/cracker.c 2012-07-17 16:14:27.609375000 +0000 +++ jumbo-bleed1/src/cracker.c 2012-07-16 17:23:40.656250000 +0000 @@ -232,10 +232,10 @@ static int crk_process_guess(struct db_s extern void mediawiki_fix_salt(char *Buf, char *source_to_fix, char *salt_rec, int max_salt_len); mediawiki_fix_salt(Buf, pw->source, cp2, options.regen_lost_salts+1); strcpy(pw->source, Buf); - } + } else if (options.regen_lost_salts == 6) { - // formspring sha256($s.$p), $dynamic_61$, where $s is ?d?d (2 digits). + // formspring sha256($s.$p), $dynamic_61$, where $s is ?d?d (2 digits). char *cp = pw->source; char *cp2 = *(char**)(salt->salt); memcpy(cp+12+64+1, cp2+6, 2); diff -urpN jumbo-bleed2/src/dynamic.h jumbo-bleed1/src/dynamic.h --- jumbo-bleed2/src/dynamic.h 2012-07-17 16:14:27.906250000 +0000 +++ jumbo-bleed1/src/dynamic.h 2012-07-17 17:19:23.187500000 +0000 @@ -1,28 +1,31 @@ /* * This software was written by Jim Fougeron jfoug AT cox dot net - * in 2009. No copyright is claimed, and the software is hereby + * in 2009-2012. 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 © 2009 Jim Fougeron + * null and void, then the software is Copyright © 2009-2012 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 MD5 hashes cracker + * Generic 'scriptable' hash cracker for JtR * * Interface functions and data structures required to make this * work, since it is split over multiple .c source files. * * 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 */ #if !defined (__DYNAMIC___H) #define __DYNAMIC___H +#include + typedef void(*DYNAMIC_primitive_funcp)(); typedef struct DYNAMIC_Constants_t @@ -92,12 +95,14 @@ typedef struct DYNAMIC_Constants_t #define MGF_SOURCE_SHA384 0x00020000 #define MGF_SOURCE_SHA512 0x00040000 #define MGF_SOURCE_GOST 0x00080000 -#define MGF_SHA1_40_BYTE_FINISH 0x00100000 -#define MGF_SHA224_56_BYTE_FINISH 0x00200000 -#define MGF_SHA256_64_BYTE_FINISH 0x00400000 -#define MGF_SHA384_96_BYTE_FINISH 0x00800000 -#define MGF_SHA512_128_BYTE_FINISH 0x01000000 -#define MGF_GOST_64_BYTE_FINISH 0x02000000 +#define MGF_SOURCE_WHIRLPOOL 0x00100000 +#define MGF_SHA1_40_BYTE_FINISH 0x00200000 +#define MGF_SHA224_56_BYTE_FINISH 0x00400000 +#define MGF_SHA256_64_BYTE_FINISH 0x00800000 +#define MGF_SHA384_96_BYTE_FINISH 0x01000000 +#define MGF_SHA512_128_BYTE_FINISH 0x02000000 +#define MGF_GOST_64_BYTE_FINISH 0x04000000 +#define MGF_WHIRLPOOL_128_BYTE_FINISH 0x08000000 typedef struct DYNAMIC_Setup_t { @@ -126,8 +131,6 @@ void dynamic_DISPLAY_ALL_FORMATS(); struct fmt_main *dynamic_THIN_FORMAT_LINK(struct fmt_main *pFmt, char *ciphertext, char *orig_sig, int bInitAlso); int text_in_dynamic_format_already(struct fmt_main *pFmt, char *ciphertext); -// We need access to this global to get functions and data which we 'link' to -//extern struct fmt_main fmt_MD5gen; int dynamic_Register_formats(struct fmt_main **ptr); int dynamic_RESERVED_PRELOAD_SETUP(int cnt, struct fmt_main *pFmt); @@ -321,6 +324,17 @@ extern void DynamicFunc__GOST_crypt_inpu extern void DynamicFunc__GOST_crypt_input1_to_output1_FINAL(); extern void DynamicFunc__GOST_crypt_input2_to_output1_FINAL(); +#if OPENSSL_VERSION_NUMBER >= 0x10000000 +extern void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16(); +extern void DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL(); +extern void DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL(); +#endif + // These 3 dump the raw crypt back into input (only at the head of it). // they are for phpass, wordpress, etc. extern void DynamicFunc__crypt_md5_to_input_raw(); diff -urpN jumbo-bleed2/src/dynamic_fmt.c jumbo-bleed1/src/dynamic_fmt.c --- jumbo-bleed2/src/dynamic_fmt.c 2012-07-17 16:14:27.921875000 +0000 +++ jumbo-bleed1/src/dynamic_fmt.c 2012-07-17 17:18:52.875000000 +0000 @@ -1,27 +1,34 @@ /* * This software was written by Jim Fougeron jfoug AT cox dot net - * in 2009. No copyright is claimed, and the software is hereby + * in 2009-2012. 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 © 2009 Jim Fougeron + * null and void, then the software is Copyright © 2009-2012 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 + * + * 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 + * * There used to be a todo list, and other commenting here. It has been * moved to ./docs/dynamic_history.txt * * KNOWN issues, and things to do. * - * 1. MD5 and MD4 MUST both be using same SSE_PARA values, and built the + * 1. MD5 and MD4 MUST both be using same SSE_PARA values, and built the * same (I think). If not, then MD4 should fall back to X86 mode. * 2. Add more crypt types, using the SHA1 'model'. Currently, all * sha2 crypts have been added (sha224, sha256, sha384, sha512). * others could be any from oSSL, or any that we can get hash files * for (such as GOST, IDA, IDEA, AES, CAST, Whirlpool, etc, etc) - * 3. create a new optimize flag, MGF_PASS_AFTER_FIXEDSALT and + * 3. create a new optimize flag, MGF_PASS_AFTER_FIXEDSALT and * MGF_PASS_BEFORE_FIXEDSALT. Then create DynamicFunc__appendsalt_after_pass[12] * These would only be valid for a FIXED length salted format. Then * we can write the pass right into the buffer, and get_key() would read @@ -40,7 +47,7 @@ static DYNAMIC_primitive_funcp _Funcs_1[ NULL }; -WELL, the fixed size salt, it 'may' not be key for the MGF_PASS_BEFORE_FIXEDSALT, I think I can +WELL, the fixed size salt, it 'may' not be key for the MGF_PASS_BEFORE_FIXEDSALT, I think I can make that 'work' for variable sized salts. But for the MGF_PASS_AFTER_FIXEDSALT, i.e. crypt($s.$p) the fixed size salt IS key. I would like to store all PW's at salt_len offset in the buffer, and simply overwrite the first part of each buffer with the salt, never moving the password after the @@ -69,6 +76,10 @@ ahead of time. #include "johnswap.h" #include "pkzip.h" +#if OPENSSL_VERSION_NUMBER >= 0x10000000 +#include "openssl/whrlpool.h" +#endif + #define STRINGIZE2(s) #s #define STRINGIZE(s) STRINGIZE2(s) @@ -439,8 +450,7 @@ static int usernamelen; static unsigned char *flds[10]; static int fld_lens[10]; -static char itoa16_up[16] = "0123456789ABCDEF"; -static char *md5gen_itoa16 = itoa16; +static 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 @@ -519,6 +529,8 @@ typedef struct private_subformat_data int dynamic_96_byte_sha384; int dynamic_128_byte_sha512; int dynamic_64_byte_gost; + int dynamic_128_byte_whirlpool; + // 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 // not have constants. @@ -659,7 +671,7 @@ static int valid(char *ciphertext, struc cipherTextLen = 56; } else if (pPriv->dynamic_96_byte_sha384) { cipherTextLen = 96; - } else if (pPriv->dynamic_128_byte_sha512) { + } else if (pPriv->dynamic_128_byte_sha512 || pPriv->dynamic_128_byte_whirlpool) { cipherTextLen = 128; } for (i = 0; i < cipherTextLen; i++) { @@ -1437,12 +1449,12 @@ static void crypt_all(int count) md5_unicode_convert = 0; if (curdat.dynamic_base16_upcase) { - md5gen_itoa16 = itoa16_up; - itoa16_w2=itoa16_w2_u; + dynamic_itoa16 = itoa16u; + itoa16_w2 = itoa16_w2_u; } else { - md5gen_itoa16 = itoa16; - itoa16_w2=itoa16_w2_l; + dynamic_itoa16 = itoa16; + itoa16_w2 = itoa16_w2_l; } // There may have to be some 'prelim' work done with the keys. This is so that if we 'know' that keys were @@ -1978,8 +1990,8 @@ static void *salt(char *ciphertext) cpi = Buf; for (i = 0; i < 16; ++i) { - *cpo++ = md5gen_itoa16[(*cpi)>>4]; - *cpo++ = md5gen_itoa16[(*cpi)&0xF]; + *cpo++ = dynamic_itoa16[(*cpi)>>4]; + *cpo++ = dynamic_itoa16[(*cpi)&0xF]; ++cpi; } *cpo = 0; @@ -2043,8 +2055,8 @@ static void *salt(char *ciphertext) cp3 = Buf; for (i = 0; i < 16; ++i) { - *cp2++ = md5gen_itoa16[(*cp3)>>4]; - *cp2++ = md5gen_itoa16[(*cp3)&0xF]; + *cp2++ = dynamic_itoa16[(*cp3)>>4]; + *cp2++ = dynamic_itoa16[(*cp3)&0xF]; ++cp3; } *cp2 = 0; @@ -2247,6 +2259,23 @@ static char *source_gost(char *source, v *cpo = 0; return Buf; } +static char *source_whirlpool(char *source, void *binary) +{ + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); + char *cpo = Buf; + int i; + + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); + for (i = 0; i < 64; ++i) { + *cpo++ = itoa16[(*cpi)>>4]; + *cpo++ = itoa16[*cpi&0xF]; + ++cpi; + } + *cpo = 0; + return Buf; +} + /********************************************************************************* * Gets the binary value from a base-64 hash (such as phpass) @@ -5592,8 +5621,8 @@ void DynamicFunc__overwrite_from_last_ou {cpo = input_buf_X86[j>>MD5_X2].x1.B; cpi = crypt_key_X86[j>>MD5_X2].x1.B; /* w=input_buf_X86[j>>MD5_X2].x1.w; */ } for (i = 0; i < 16; ++i, ++cpi) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; + *cpo++ = dynamic_itoa16[*cpi>>4]; + *cpo++ = dynamic_itoa16[*cpi&0xF]; } //MD5_swap(w,w,4); // if swapped, then HDAA fails on big endian systems. @@ -5628,8 +5657,8 @@ void DynamicFunc__append_from_last_outpu for (j = 0; j < 16; ++j) { unsigned char v = crypt_key[idx][GETPOS(j, index&(MMX_COEF-1))]; - input_buf[idx][GETPOS(ip+(j<<1), index&(MMX_COEF-1))] = md5gen_itoa16[v>>4]; - input_buf[idx][GETPOS(ip+(j<<1)+1, index&(MMX_COEF-1))] = md5gen_itoa16[v&0xF]; + input_buf[idx][GETPOS(ip+(j<<1), index&(MMX_COEF-1))] = dynamic_itoa16[v>>4]; + input_buf[idx][GETPOS(ip+(j<<1)+1, index&(MMX_COEF-1))] = dynamic_itoa16[v&0xF]; } input_buf[idx][GETPOS(ip+32, index&(MMX_COEF-1))] = 0x80; } @@ -5655,8 +5684,8 @@ void DynamicFunc__append_from_last_outpu for (i = 0; i < 16; ++i) { unsigned char b = *cpi++; - *cp++ = md5gen_itoa16[b>>4]; - *cp++ = md5gen_itoa16[b&0xF]; + *cp++ = dynamic_itoa16[b>>4]; + *cp++ = dynamic_itoa16[b&0xF]; } *cp = 0; total_len_X86[j] += 32; @@ -5689,8 +5718,8 @@ void DynamicFunc__append_from_last_outpu for (i = 0; i < 16; ++i) { unsigned char v = crypt_key2[idx][GETPOS(i, index&(MMX_COEF-1))]; - input_buf2[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = md5gen_itoa16[v>>4]; - input_buf2[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = md5gen_itoa16[v&0xF]; + input_buf2[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = dynamic_itoa16[v>>4]; + input_buf2[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = dynamic_itoa16[v&0xF]; } input_buf2[idx][GETPOS(ip+32, index&(MMX_COEF-1))] = 0x80; } @@ -5715,8 +5744,8 @@ void DynamicFunc__append_from_last_outpu for (j = 0; j < 16; ++j) { unsigned char b = *cpi++; - *cp++ = md5gen_itoa16[b>>4]; - *cp++ = md5gen_itoa16[b&0xF]; + *cp++ = dynamic_itoa16[b>>4]; + *cp++ = dynamic_itoa16[b&0xF]; } *cp = 0; total_len2_X86[i] += 32; @@ -5756,8 +5785,8 @@ void DynamicFunc__overwrite_from_last_ou {cpo = input_buf2_X86[j>>MD5_X2].x1.B; cpi = crypt_key_X86[j>>MD5_X2].x1.B; /* w=input_buf_X86[j>>MD5_X2].x1.w; */ } for (i = 0; i < 16; ++i, ++cpi) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; + *cpo++ = dynamic_itoa16[*cpi>>4]; + *cpo++ = dynamic_itoa16[*cpi&0xF]; } //MD5_swap(w,w,4); // if swapped, then HDAA fails on big endian systems. @@ -5793,8 +5822,8 @@ void DynamicFunc__overwrite_from_last_ou {cpo = input_buf2_X86[j>>MD5_X2].x1.B; cpi = crypt_key2_X86[j>>MD5_X2].x1.B; /* w=input_buf_X86[j>>MD5_X2].x1.w; */ } for (i = 0; i < 16; ++i, ++cpi) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; + *cpo++ = dynamic_itoa16[*cpi>>4]; + *cpo++ = dynamic_itoa16[*cpi&0xF]; } //MD5_swap(w,w,4); // if swapped, then HDAA fails on big endian systems. @@ -5828,8 +5857,8 @@ void DynamicFunc__append_from_last_outpu for (i = 0; i < 16; ++i) { unsigned char v = crypt_key[idx][GETPOS(i, index&(MMX_COEF-1))]; - input_buf2[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = md5gen_itoa16[v>>4]; - input_buf2[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = md5gen_itoa16[v&0xF]; + input_buf2[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = dynamic_itoa16[v>>4]; + input_buf2[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = dynamic_itoa16[v&0xF]; } input_buf2[idx][GETPOS(ip+32, index&(MMX_COEF-1))] = 0x80; } @@ -5854,8 +5883,8 @@ void DynamicFunc__append_from_last_outpu for (j = 0; j < 16; ++j) { unsigned char b = *cpi++; - *cp++ = md5gen_itoa16[b>>4]; - *cp++ = md5gen_itoa16[b&0xF]; + *cp++ = dynamic_itoa16[b>>4]; + *cp++ = dynamic_itoa16[b&0xF]; } *cp = 0; total_len2_X86[i] += 32; @@ -5888,8 +5917,8 @@ void DynamicFunc__append_from_last_outpu for (i = 0; i < 16; ++i) { unsigned char v = crypt_key2[idx][GETPOS(i, index&(MMX_COEF-1))]; - input_buf[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = md5gen_itoa16[v>>4]; - input_buf[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = md5gen_itoa16[v&0xF]; + input_buf[idx][GETPOS(ip+(i<<1), index&(MMX_COEF-1))] = dynamic_itoa16[v>>4]; + input_buf[idx][GETPOS(ip+(i<<1)+1, index&(MMX_COEF-1))] = dynamic_itoa16[v&0xF]; } input_buf[idx][GETPOS(ip+32, index&(MMX_COEF-1))] = 0x80; } @@ -5914,8 +5943,8 @@ void DynamicFunc__append_from_last_outpu for (j = 0; j < 16; ++j) { unsigned char b = *cpi++; - *cp++ = md5gen_itoa16[b>>4]; - *cp++ = md5gen_itoa16[b&0xF]; + *cp++ = dynamic_itoa16[b>>4]; + *cp++ = dynamic_itoa16[b&0xF]; } *cp = 0; total_len_X86[i] += 32; @@ -6489,11 +6518,11 @@ void DynamicFunc__ToX86() { } void DynamicFunc__base16_convert_locase() { - md5gen_itoa16 = itoa16; + dynamic_itoa16 = itoa16; itoa16_w2=itoa16_w2_l; } void DynamicFunc__base16_convert_upcase() { - md5gen_itoa16 = itoa16_up; + dynamic_itoa16 = itoa16u; itoa16_w2=itoa16_w2_u; } @@ -6506,6 +6535,29 @@ void DynamicFunc__base16_convert_upcase( ************************************************************** **************************************************************/ +// 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; +} + #ifdef MMX_COEF void SHA1_SSE_Crypt(MD5_IN input[MAX_KEYS_PER_CRYPT_X86], unsigned int ilen[MAX_KEYS_PER_CRYPT_X86], MD5_IN out[MAX_KEYS_PER_CRYPT_X86] , unsigned int olen[MAX_KEYS_PER_CRYPT_X86], int append) @@ -6631,9 +6683,9 @@ void SHA1_SSE_Crypt_final(MD5_IN input[M void DynamicFunc__SHA1_crypt_input1_append_input2_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input1(); @@ -6658,13 +6710,7 @@ void DynamicFunc__SHA1_crypt_input1_appe cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 20); total_len2_X86[i] += 40; } if (switchback==1) { @@ -6674,9 +6720,9 @@ void DynamicFunc__SHA1_crypt_input1_appe void DynamicFunc__SHA1_crypt_input2_append_input1_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input1(); @@ -6701,13 +6747,7 @@ void DynamicFunc__SHA1_crypt_input2_appe cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 20); total_len_X86[i] += 40; } if (switchback==1) { @@ -6717,9 +6757,9 @@ void DynamicFunc__SHA1_crypt_input2_appe void DynamicFunc__SHA1_crypt_input1_overwrite_input1_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input1(); @@ -6743,13 +6783,8 @@ void DynamicFunc__SHA1_crypt_input1_over cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - memset(cpo, 0, 16); + cpo = hex_out_buf_no_null(crypt_out, cpo, 20); + //memset(cpo, 0, 16); total_len_X86[i] = 40; } if (switchback==1) { @@ -6759,9 +6794,9 @@ void DynamicFunc__SHA1_crypt_input1_over void DynamicFunc__SHA1_crypt_input1_overwrite_input2_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input1(); @@ -6785,13 +6820,8 @@ void DynamicFunc__SHA1_crypt_input1_over cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - memset(cpo, 0, 16); + cpo = hex_out_buf_no_null(crypt_out, cpo, 20); + //memset(cpo, 0, 16); total_len2_X86[i] = 40; } if (switchback==1) { @@ -6801,9 +6831,9 @@ void DynamicFunc__SHA1_crypt_input1_over void DynamicFunc__SHA1_crypt_input2_overwrite_input1_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input2(); @@ -6827,13 +6857,8 @@ void DynamicFunc__SHA1_crypt_input2_over cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - memset(cpo, 0, 16); + cpo = hex_out_buf_no_null(crypt_out, cpo, 20); + //memset(cpo, 0, 16); total_len_X86[i] = 40; } if (switchback==1) { @@ -6843,9 +6868,9 @@ void DynamicFunc__SHA1_crypt_input2_over void DynamicFunc__SHA1_crypt_input2_overwrite_input2_base16() { union xx { unsigned char u[20]; ARCH_WORD a[20/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; + unsigned char *crypt_out=u.u, *cpo; int switchback=dynamic_use_sse; - int i, j; + int i; if (dynamic_use_sse == 1) { DynamicFunc__SSEtoX86_switch_input2(); @@ -6869,13 +6894,7 @@ void DynamicFunc__SHA1_crypt_input2_over cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA1_Final(crypt_out, &sha_ctx); - cpi = crypt_out; - for (j = 0; j < 20; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 20); total_len2_X86[i] = 40; } if (switchback==1) { @@ -6974,12 +6993,12 @@ void DynamicFunc__SHA1_crypt_input2_to_o } /******************************************************************** - **** Here are the SHA224 and SHA256 functions!!! + **** Here are the SHA224 and SHA256 functions!!! *******************************************************************/ void DynamicFunc__SHA224_crypt_input1_append_input2_base16() { union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -6996,20 +7015,14 @@ void DynamicFunc__SHA224_crypt_input1_ap cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 28); total_len2_X86[i] += 56; } } void DynamicFunc__SHA256_crypt_input1_append_input2_base16() { union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7026,20 +7039,14 @@ void DynamicFunc__SHA256_crypt_input1_ap cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 32); total_len2_X86[i] += 64; } } void DynamicFunc__SHA224_crypt_input2_append_input1_base16() { union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7056,20 +7063,14 @@ void DynamicFunc__SHA224_crypt_input2_ap cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 28); total_len_X86[i] += 56; } } void DynamicFunc__SHA256_crypt_input2_append_input1_base16() { union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7086,20 +7087,14 @@ void DynamicFunc__SHA256_crypt_input2_ap cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf(crypt_out, cpo, 32); total_len_X86[i] += 64; } } void DynamicFunc__SHA224_crypt_input1_overwrite_input1_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7116,20 +7111,14 @@ void DynamicFunc__SHA224_crypt_input1_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 28); total_len_X86[i] = 56; } } void DynamicFunc__SHA256_crypt_input1_overwrite_input1_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7146,20 +7135,14 @@ void DynamicFunc__SHA256_crypt_input1_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 32); total_len_X86[i] = 64; } } void DynamicFunc__SHA224_crypt_input1_overwrite_input2_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7176,20 +7159,14 @@ void DynamicFunc__SHA224_crypt_input1_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 28); total_len2_X86[i] = 56; } } void DynamicFunc__SHA256_crypt_input1_overwrite_input2_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7206,20 +7183,14 @@ void DynamicFunc__SHA256_crypt_input1_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 32); total_len2_X86[i] = 64; } } void DynamicFunc__SHA224_crypt_input2_overwrite_input1_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7236,20 +7207,14 @@ void DynamicFunc__SHA224_crypt_input2_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 28); total_len_X86[i] = 56; } } void DynamicFunc__SHA256_crypt_input2_overwrite_input1_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7266,20 +7231,14 @@ void DynamicFunc__SHA256_crypt_input2_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 32); total_len_X86[i] = 64; } } void DynamicFunc__SHA224_crypt_input2_overwrite_input2_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7296,20 +7255,14 @@ void DynamicFunc__SHA224_crypt_input2_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA224_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 28); total_len2_X86[i] = 56; } } void DynamicFunc__SHA256_crypt_input2_overwrite_input2_base16(){ union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA256_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7326,13 +7279,7 @@ void DynamicFunc__SHA256_crypt_input2_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA256_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; + hex_out_buf_no_null(crypt_out, cpo, 32); total_len2_X86[i] = 64; } } @@ -7466,12 +7413,12 @@ void DynamicFunc__SHA256_crypt_input2_to } /******************************************************************** - **** Here are the SHA384 and SHA512 functions!!! + **** Here are the SHA384 and SHA512 functions!!! *******************************************************************/ void DynamicFunc__SHA384_crypt_input1_append_input2_base16() { - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7488,20 +7435,14 @@ void DynamicFunc__SHA384_crypt_input1_ap cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] += 56; + hex_out_buf(crypt_out, cpo, 48); + total_len2_X86[i] += 96; } } void DynamicFunc__SHA512_crypt_input1_append_input2_base16() { - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7518,20 +7459,14 @@ void DynamicFunc__SHA512_crypt_input1_ap cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.b[total_len2_X86[i]]); } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] += 64; + hex_out_buf(crypt_out, cpo, 64); + total_len2_X86[i] += 128; } } void DynamicFunc__SHA384_crypt_input2_append_input1_base16() { - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7548,20 +7483,14 @@ void DynamicFunc__SHA384_crypt_input2_ap cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] += 56; + hex_out_buf(crypt_out, cpo, 48); + total_len_X86[i] += 96; } } void DynamicFunc__SHA512_crypt_input2_append_input1_base16() { - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7578,20 +7507,14 @@ void DynamicFunc__SHA512_crypt_input2_ap cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] += 64; + hex_out_buf(crypt_out, cpo, 64); + total_len_X86[i] += 128; } } void DynamicFunc__SHA384_crypt_input1_overwrite_input1_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7608,20 +7531,14 @@ void DynamicFunc__SHA384_crypt_input1_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 48); + total_len_X86[i] = 96; } } void DynamicFunc__SHA512_crypt_input1_overwrite_input1_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7638,20 +7555,14 @@ void DynamicFunc__SHA512_crypt_input1_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 64; + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len_X86[i] = 128; } } void DynamicFunc__SHA384_crypt_input1_overwrite_input2_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7668,20 +7579,14 @@ void DynamicFunc__SHA384_crypt_input1_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 48); + total_len2_X86[i] = 96; } } void DynamicFunc__SHA512_crypt_input1_overwrite_input2_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7698,20 +7603,14 @@ void DynamicFunc__SHA512_crypt_input1_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 64; + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len2_X86[i] = 128; } } void DynamicFunc__SHA384_crypt_input2_overwrite_input1_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7728,20 +7627,14 @@ void DynamicFunc__SHA384_crypt_input2_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 48); + total_len_X86[i] = 96; } } void DynamicFunc__SHA512_crypt_input2_overwrite_input1_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7758,20 +7651,14 @@ void DynamicFunc__SHA512_crypt_input2_ov cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 64; + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len_X86[i] = 128; } } void DynamicFunc__SHA384_crypt_input2_overwrite_input2_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[56]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7788,20 +7675,14 @@ void DynamicFunc__SHA384_crypt_input2_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA384_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 48); + total_len2_X86[i] = 96; } } void DynamicFunc__SHA512_crypt_input2_overwrite_input2_base16(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; SHA512_CTX ctx; for (i = 0; i < m_count; ++i) { @@ -7818,18 +7699,12 @@ void DynamicFunc__SHA512_crypt_input2_ov cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } SHA512_Final(crypt_out, &ctx); - cpi = crypt_out; - for (j = 0; j < 32; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 64; + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len2_X86[i] = 128; } } void DynamicFunc__SHA384_crypt_input1_to_output1_FINAL(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; SHA512_CTX ctx; @@ -7861,7 +7736,7 @@ void DynamicFunc__SHA384_crypt_input1_to } } void DynamicFunc__SHA512_crypt_input1_to_output1_FINAL(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; SHA512_CTX ctx; @@ -7893,7 +7768,7 @@ void DynamicFunc__SHA512_crypt_input1_to } } void DynamicFunc__SHA384_crypt_input2_to_output1_FINAL(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; SHA512_CTX ctx; @@ -7925,7 +7800,7 @@ void DynamicFunc__SHA384_crypt_input2_to } } void DynamicFunc__SHA512_crypt_input2_to_output1_FINAL(){ - union xx { unsigned char u[64]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; SHA512_CTX ctx; @@ -7962,9 +7837,9 @@ void DynamicFunc__SHA512_crypt_input2_to *************************************************************/ void DynamicFunc__GOST_crypt_input1_append_input2_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -7981,20 +7856,14 @@ void DynamicFunc__GOST_crypt_input1_appe cpo = (unsigned char *)&(input_buf2_X86[i>>MD5_X2].x1.B[total_len2_X86[i]]); } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] += 56; + hex_out_buf(crypt_out, cpo, 32); + total_len2_X86[i] += 64; } } void DynamicFunc__GOST_crypt_input2_append_input1_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -8011,20 +7880,14 @@ void DynamicFunc__GOST_crypt_input2_appe cpo = (unsigned char *)&(input_buf_X86[i>>MD5_X2].x1.b[total_len_X86[i]]); } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] += 56; + hex_out_buf(crypt_out, cpo, 32); + total_len_X86[i] += 64; } } void DynamicFunc__GOST_crypt_input1_overwrite_input1_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -8041,20 +7904,14 @@ void DynamicFunc__GOST_crypt_input1_over cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 32); + total_len_X86[i] = 64; } } void DynamicFunc__GOST_crypt_input2_overwrite_input2_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -8071,20 +7928,14 @@ void DynamicFunc__GOST_crypt_input2_over cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 32); + total_len2_X86[i] = 64; } } void DynamicFunc__GOST_crypt_input1_overwrite_input2_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -8101,20 +7952,14 @@ void DynamicFunc__GOST_crypt_input1_over cpo = (unsigned char *)input_buf2_X86[i>>MD5_X2].x1.b; } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len2_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 32); + total_len2_X86[i] = 64; } } void DynamicFunc__GOST_crypt_input2_overwrite_input1_base16() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; - unsigned char *crypt_out=u.u, *cpi, *cpo; - int i, j; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; gost_ctx ctx; for (i = 0; i < m_count; ++i) { @@ -8131,18 +7976,12 @@ void DynamicFunc__GOST_crypt_input2_over cpo = (unsigned char *)input_buf_X86[i>>MD5_X2].x1.b; } john_gost_final(&ctx, crypt_out); - cpi = crypt_out; - for (j = 0; j < 28; ++j) { - *cpo++ = md5gen_itoa16[*cpi>>4]; - *cpo++ = md5gen_itoa16[*cpi&0xF]; - ++cpi; - } - *cpo = 0; - total_len_X86[i] = 56; + hex_out_buf_no_null(crypt_out, cpo, 32); + total_len_X86[i] = 64; } } void DynamicFunc__GOST_crypt_input1_to_output1_FINAL() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; gost_ctx ctx; @@ -8174,7 +8013,7 @@ void DynamicFunc__GOST_crypt_input1_to_o } } void DynamicFunc__GOST_crypt_input2_to_output1_FINAL() { - union xx { unsigned char u[32]; ARCH_WORD a[16/sizeof(ARCH_WORD)]; } u; + union xx { unsigned char u[32]; ARCH_WORD a[32/sizeof(ARCH_WORD)]; } u; unsigned char *crypt_out=u.u; int i; gost_ctx ctx; @@ -8207,6 +8046,220 @@ void DynamicFunc__GOST_crypt_input2_to_o } /************************************************************** + ** WHIRLPOOL functions for dynamic + *************************************************************/ +#if OPENSSL_VERSION_NUMBER >= 0x10000000 +void DynamicFunc__WHIRLPOOL_crypt_input1_append_input2_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf(crypt_out, cpo, 64); + total_len2_X86[i] += 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_append_input1_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf(crypt_out, cpo, 64); + total_len_X86[i] += 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len_X86[i] = 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len2_X86[i] = 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len2_X86[i] = 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u, *cpo; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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); + hex_out_buf_no_null(crypt_out, cpo, 64); + total_len_X86[i] = 128; + } +} +void DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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() { + union xx { unsigned char u[64]; ARCH_WORD a[64/sizeof(ARCH_WORD)]; } u; + unsigned char *crypt_out=u.u; + int i; + WHIRLPOOL_CTX ctx; + + for (i = 0; i < m_count; ++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 + +/************************************************************** ************************************************************** * DYNAMIC primitive helper function * These are not done yet. Usage of them will exit john with @@ -8376,6 +8429,21 @@ static int isGOSTFunc(DYNAMIC_primitive_ 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_input2_append_input1_base16 || + p==DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input1_base16 || + p==DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input2_base16 || + p==DynamicFunc__WHIRLPOOL_crypt_input1_overwrite_input2_base16 || + p==DynamicFunc__WHIRLPOOL_crypt_input2_overwrite_input1_base16 || + p==DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL || + p==DynamicFunc__WHIRLPOOL_crypt_input2_to_output1_FINAL) + return 1; +#endif + return 0; +} + int dynamic_SETUP(DYNAMIC_Setup *Setup, struct fmt_main *pFmt) { int i, j, cnt, cnt2, x; @@ -8409,6 +8477,7 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, curdat.dynamic_96_byte_sha384 = ((Setup->startFlags&MGF_SHA384_96_BYTE_FINISH)==MGF_SHA384_96_BYTE_FINISH) ? 1 : 0; 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.b2Salts = ((Setup->flags&MGF_SALTED2)==MGF_SALTED2) ? 1 : 0; curdat.dynamic_base16_upcase = ((Setup->flags&MGF_BASE_16_OUTPUT_UPCASE)==MGF_BASE_16_OUTPUT_UPCASE) ? 1 : 0; @@ -8601,6 +8670,7 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, if (Setup->startFlags&MGF_SOURCE_SHA384) pFmt->methods.source = source_sha384; if (Setup->startFlags&MGF_SOURCE_SHA512) pFmt->methods.source = source_sha512; if (Setup->startFlags&MGF_SOURCE_GOST) pFmt->methods.source = source_gost; + if (Setup->startFlags&MGF_SOURCE_WHIRLPOOL) pFmt->methods.source = source_whirlpool; if (!curdat.store_keys_in_input && Setup->startFlags&MGF_KEYS_INPUT_BE_SAFE) curdat.store_keys_in_input = 3; @@ -8838,19 +8908,26 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) pFmt->params.algorithm_name = ALGORITHM_NAME_X86_S2; } - if (isGOSTFunc(pFuncs[x])) { - // STILL TODO - if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME)) - pFmt->params.algorithm_name = ALGORITHM_NAME_S2; - else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) - pFmt->params.algorithm_name = ALGORITHM_NAME_X86_S2; - } if (isMD4Func(pFuncs[x])) { if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME)) pFmt->params.algorithm_name = ALGORITHM_NAME_4; else if(!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) pFmt->params.algorithm_name = ALGORITHM_NAME_X86_4; } + if (isWHIRLFunc(pFuncs[x])) { + // STILL TODO + //if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME)) + // pFmt->params.algorithm_name = ALGORITHM_NAME_S2; + //else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) + // pFmt->params.algorithm_name = ALGORITHM_NAME_X86_S2; + } + if (isGOSTFunc(pFuncs[x])) { + // STILL TODO + //if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME)) + // pFmt->params.algorithm_name = ALGORITHM_NAME_S2; + //else if (!strcmp(pFmt->params.algorithm_name, ALGORITHM_NAME_X86)) + // pFmt->params.algorithm_name = ALGORITHM_NAME_X86_S2; + } } if (curdat.dynamic_FUNCTIONS[j-1] == DynamicFunc__SHA1_crypt_input1_to_output1_FINAL || @@ -8906,9 +8983,9 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, } if (curdat.dynamic_base16_upcase) - md5gen_itoa16 = itoa16_up; + dynamic_itoa16 = itoa16u; else - md5gen_itoa16 = itoa16; + dynamic_itoa16 = itoa16; return 1; } @@ -8963,7 +9040,7 @@ static int LoadOneFormat(int idx, struct curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 56 + 1; else if (curdat.dynamic_96_byte_sha384) curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 96 + 1; - else if (curdat.dynamic_128_byte_sha512) + else if (curdat.dynamic_128_byte_sha512 || curdat.dynamic_128_byte_whirlpool) curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 128 + 1; else curdat.dynamic_SALT_OFFSET = curdat.dynamic_HASH_OFFSET + 32 + 1; diff -urpN jumbo-bleed2/src/dynamic_parser.c jumbo-bleed1/src/dynamic_parser.c --- jumbo-bleed2/src/dynamic_parser.c 2012-07-17 16:14:27.921875000 +0000 +++ jumbo-bleed1/src/dynamic_parser.c 2012-07-17 16:19:12.281250000 +0000 @@ -1,30 +1,30 @@ /* * This software was written by Jim Fougeron jfoug AT cox dot net - * in 2009. No copyright is claimed, and the software is hereby + * in 2009-2012. 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 © 2009 Jim Fougeron + * null and void, then the software is Copyright © 2009-2012 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 MD5 hashes cracker + * Generic 'scriptable' hash cracker for JtR * * This file implements code that allows 'dynamic' building of * generic MD5 functions. john.conf is used to store the 'script' * and supporting data (like the expression, or 'flags' needed to * make the format work). * - * To make this work, you simply add a "section" to the john.conf - * file of this format: + * To make this work, you simply add a "section" to the dynamic.conf, + * or better yet, to the john.local.conf file of this format: * * [List.Generic:dynamic_NUM ( [List.Generic:md5_gen(NUM)] depricated but 'works') * - * Num has to be replaced with a number, greater than 1000, since - * dynamic_0 to dynamic_1000 are reserved for 'built-in' and any - * user defined dynamic_# functions need to start at 1001 or more. + * Num has to be replaced with a number, greater than 999, since + * dynamic_0 to dynamic_999 are reserved for 'built-in' and any + * user defined dynamic_# functions need to start at 1000 or more. * * Then under the new section, add the script. There are 2 required * data types, and 2 optional. The required are a list of Func= @@ -36,22 +36,24 @@ * [List.Generic:dynamic_1001] * Expression=md5(md5(md5(md5($p)))) * Flag=MGF_KEYS_INPUT - * Func=DynamicFunc__crypt + * Func=DynamicFunc__crypt_md5 * Func=DynamicFunc__clean_input2 * Func=DynamicFunc__append_from_last_output_to_input2_as_base16 - * Func=DynamicFunc__crypt2 + * Func=DynamicFunc__crypt2_md5 * Func=DynamicFunc__clean_input2_kwik * Func=DynamicFunc__append_from_last_output2_as_base16 - * Func=DynamicFunc__crypt2 + * Func=DynamicFunc__crypt2_md5 * Func=DynamicFunc__clean_input2_kwik * Func=DynamicFunc__append_from_last_output2_as_base16 - * Func=DynamicFunc__crypt_in2_to_out1 + * Func=DynamicFunc__crypt_md5_in2_to_out1 * Test=$dynamic_1001$57200e13b490d4ae47d5e19be026b057:test1 * Test=$dynamic_1001$c6cc44f9e7fb7efcde62ba2e627a49c6:thatsworking * Test=$dynamic_1001$0ae9549604e539a249c1fa9f5e5fb73b:test3 * * 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 * */ @@ -72,20 +74,20 @@ #define DEFINE_MD5_PREDICATE_POINTERS #include "dynamic.h" -typedef struct MD5Gen_Predicate_t +typedef struct Dynamic_Predicate_t { char *name; void(*func)(); -} MD5Gen_Predicate_t; +} Dynamic_Predicate_t; -typedef struct MD5Gen_Str_Flag_t +typedef struct Dynamic_Str_Flag_t { char *name; unsigned flag_bit; -} MD5Gen_Str_Flag_t; +} Dynamic_Str_Flag_t; -static MD5Gen_Predicate_t MD5Gen_Predicate[] = { +static Dynamic_Predicate_t Dynamic_Predicate[] = { { "DynamicFunc__clean_input", DynamicFunc__clean_input }, { "DynamicFunc__clean_input_kwik", DynamicFunc__clean_input_kwik }, { "DynamicFunc__clean_input_full", DynamicFunc__clean_input_full }, @@ -238,6 +240,16 @@ static MD5Gen_Predicate_t MD5Gen_Predica { "DynamicFunc__GOST_crypt_input2_overwrite_input1_base16", DynamicFunc__GOST_crypt_input2_overwrite_input1_base16 }, { "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_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 }, + { "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 // Depricated. These are the 'original' md5_gen version. We have changed to using Dynamic_Func__ but still 'parse' // and use the MD5GenBaseFunc__ script files. @@ -349,7 +361,7 @@ static MD5Gen_Predicate_t MD5Gen_Predica { NULL, NULL }}; -static MD5Gen_Str_Flag_t MD5Gen_Str_Flag[] = { +static Dynamic_Str_Flag_t Dynamic_Str_Flag[] = { { "MGF_NOTSSE2Safe", MGF_NOTSSE2Safe }, { "MGF_StartInX86Mode", MGF_StartInX86Mode }, { "MGF_ColonNOTValid", MGF_ColonNOTValid }, @@ -383,7 +395,7 @@ static MD5Gen_Str_Flag_t MD5Gen_Str_Flag { "MGF_FULL_CLEAN_REQUIRED", MGF_FULL_CLEAN_REQUIRED }, { NULL, 0 }}; -static MD5Gen_Str_Flag_t MD5Gen_Str_sFlag[] = { +static Dynamic_Str_Flag_t Dynamic_Str_sFlag[] = { { "MGF_KEYS_INPUT", MGF_KEYS_INPUT }, { "MGF_KEYS_CRYPT_IN2", MGF_KEYS_CRYPT_IN2 }, { "MGF_KEYS_BASE16_IN1", MGF_KEYS_BASE16_IN1 }, @@ -404,12 +416,14 @@ static MD5Gen_Str_Flag_t MD5Gen_Str_sFla { "MGF_SOURCE_SHA384", MGF_SOURCE_SHA384 }, { "MGF_SOURCE_SHA512", MGF_SOURCE_SHA512 }, { "MGF_SOURCE_GOST", MGF_SOURCE_GOST }, + { "MGF_SOURCE_WHIRLPOOL", MGF_SOURCE_WHIRLPOOL }, { "MGF_SHA1_40_BYTE_FINISH", MGF_SHA1_40_BYTE_FINISH }, { "MGF_SHA224_56_BYTE_FINISH", MGF_SHA224_56_BYTE_FINISH }, { "MGF_SHA256_64_BYTE_FINISH", MGF_SHA256_64_BYTE_FINISH }, { "MGF_SHA384_96_BYTE_FINISH", MGF_SHA384_96_BYTE_FINISH }, { "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 }, { NULL, 0 }}; static DYNAMIC_Setup *pSetup; @@ -535,11 +549,11 @@ int dynamic_LOAD_PARSER_FUNCTIONS_LoadLI if (c == 'f' && !strncasecmp(Line, "Func=", 5)) { int i; - for (i = 0; MD5Gen_Predicate[i].name; ++i) + for (i = 0; Dynamic_Predicate[i].name; ++i) { - if (!strcmp(MD5Gen_Predicate[i].name, &Line[5])) + if (!strcmp(Dynamic_Predicate[i].name, &Line[5])) { - pSetup->pFuncs[nFuncCnt++] = MD5Gen_Predicate[i].func; + pSetup->pFuncs[nFuncCnt++] = Dynamic_Predicate[i].func; return 1; } } @@ -548,19 +562,19 @@ int dynamic_LOAD_PARSER_FUNCTIONS_LoadLI if (c == 'f' && !strncasecmp(Line, "Flag=", 5)) { int i; - for (i = 0; MD5Gen_Str_Flag[i].name; ++i) + for (i = 0; Dynamic_Str_Flag[i].name; ++i) { - if (!strcmp(MD5Gen_Str_Flag[i].name, &Line[5])) + if (!strcmp(Dynamic_Str_Flag[i].name, &Line[5])) { - pSetup->flags |= MD5Gen_Str_Flag[i].flag_bit; + pSetup->flags |= Dynamic_Str_Flag[i].flag_bit; return 1; } } - for (i = 0; MD5Gen_Str_sFlag[i].name; ++i) + for (i = 0; Dynamic_Str_sFlag[i].name; ++i) { - if (!strcmp(MD5Gen_Str_sFlag[i].name, &Line[5])) + if (!strcmp(Dynamic_Str_sFlag[i].name, &Line[5])) { - pSetup->startFlags |= MD5Gen_Str_sFlag[i].flag_bit; + pSetup->startFlags |= Dynamic_Str_sFlag[i].flag_bit; return 1; } } diff -urpN jumbo-bleed2/src/dynamic_preloads.c jumbo-bleed1/src/dynamic_preloads.c --- jumbo-bleed2/src/dynamic_preloads.c 2012-07-17 16:14:27.921875000 +0000 +++ jumbo-bleed1/src/dynamic_preloads.c 2012-07-17 17:11:36.468750000 +0000 @@ -1,25 +1,26 @@ /* * This software was written by Jim Fougeron jfoug AT cox dot net - * in 2009. No copyright is claimed, and the software is hereby + * in 2009-2012. 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 © 2009 Jim Fougeron + * null and void, then the software is Copyright © 2009-2012 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 MD5 hashes cracker + * Generic 'scriptable' hash cracker for JtR * - * Preloaded types md5gen(0) to md5gen(100) are 'reserved' types. + * Preloaded types dynamic_0 to dynamic_999 are 'reserved' types. * They are loaded from this file. If someone tryes to build a 'custom' * type in their john.ini file using one of those, john will abort * the run. * * 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 */ #include @@ -74,6 +75,34 @@ //dynamic_32 --> md4($p.$s) //dynamic_33 --> md4(unicode($p)) // NT //dynamic_34 --> md5(md4($p)) +//dynamic_35 -->sha1(uc($u).:.$p) (ManGOS) +//dynamic_36 -->sha1($u.:.$p) (ManGOS2) +//dynamic_37 -->sha1(lc($u).$p) (SMF) +//dynamic_38 -->sha1($s.sha1($s.sha1($p))) (Wolt3BB) + // Try to group sha224 here (from dyna-50 to dyna-59) +//dynamic_50 -->sha224($p) +//dynamic_51 -->sha224($s.$p) +//dynamic_52 -->sha224($p.$s) + // Try to group sha256 here (from dyna-60 to dyna-69) +//dynamic_60 -->sha256($p) +//dynamic_61 -->sha256($s.$p) +//dynamic_62 -->sha256($p.$s) + // Try to group sha384 here (from dyna-70 to dyna-79) +//dynamic_70 -->sha384($p) +//dynamic_71 -->sha384($s.$p) +//dynamic_72 -->sha384($p.$s) + // Try to group sha512 here (from dyna-80 to dyna-89) +//dynamic_80 -->sha512($p) +//dynamic_81 -->sha512($s.$p) +//dynamic_82 -->sha512($p.$s) + // Try to group GOST here (from dyna-90 to dyna-100) +//dynamic_90 -->GOST($p) +//dynamic_91 -->GOST($s.$p) +//dynamic_92 -->GOST($p.$s) + // Try to group WHIRLPOOL here (from dyna-100 to dyna-110) +//dynamic_100 -->WHIRLPOOL($p) +//dynamic_101 -->WHIRLPOOL($s.$p) +//dynamic_102 -->WHIRLPOOL($p.$s) static DYNAMIC_primitive_funcp _Funcs_0[] = { @@ -1295,6 +1324,66 @@ static struct fmt_tests _Preloads_92[] = {NULL} }; +#if OPENSSL_VERSION_NUMBER >= 0x10000000 +// dynamic_100: WHIRLPOOL($p) +static DYNAMIC_primitive_funcp _Funcs_100[] = +{ + //MGF_WHIRLPOOL_128_BYTE_FINISH + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_keys, + DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_100[] = +{ + {"$dynamic_100$7a3a0ec40f4b2be2bb40049a5fe0a83349b12d8ae6e9896ee6e490d5276bd150199e26aabb76d9af7a659f16070dc959e0393ef44529cad13f681129d8578df5", "test1"}, + {"$dynamic_100$296f0c87fe042a8f664980b2f6e2c59234683ec593175a33db662b4cdd1376ac239bef3f28e9fffd8d3ab4b049d87a8d224c7f33b92d4028242849d2e1baf41c", "thatsworking"}, + {"$dynamic_100$7d925e8503a922cbbc5d4d17eb232c790262ee0b06c33dc07f200c952ade2b2ddf8eeea7deec242282a700e6930d154f30c8b4096efe2633b860b48286703488", "test3"}, + {NULL} +}; + +// dynamic_101: WHIRLPOOL($s.$p) +static DYNAMIC_primitive_funcp _Funcs_101[] = +{ + //MGF_WHIRLPOOL_128_BYTE_FINISH + //MGF_SALTED + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_salt, + DynamicFunc__append_keys, + DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_101[] = +{ + {"$dynamic_101$ec4061a8201a9d60f3ee2f47b44b2356d1d15c3267c35102d3cac048254879cc20ba75dd2b56aa8872278646667c0b3c729575c1ce1c33cd1e8f6e8421ec1409$yH","test1"}, + {"$dynamic_101$f4a35e798736928804b2eef465761bd510855296b1fbb25316ac05fad5f4690578d8137c02edd889234af912b80ae603ad47a08aff0e0b6e84eda432d9da5acd$gB","thatsworking"}, + {"$dynamic_101$1f33221ae28342e78e2a90d92399029969564d19ae80a530b3b93e5336472eb056cac5d0ae0ca65fef2f46ebd3f7347d3fbb33bd2030db0916f9d25f8d4d30e4$GK","test3"}, + {NULL} +}; + +// dynamic_102: WHIRLPOOL($s.$p) +static DYNAMIC_primitive_funcp _Funcs_102[] = +{ + //MGF_WHIRLPOOL_128_BYTE_FINISH + //MGF_SALTED + //MGF_NOTSSE2Safe + DynamicFunc__clean_input, + DynamicFunc__append_keys, + DynamicFunc__append_salt, + DynamicFunc__WHIRLPOOL_crypt_input1_to_output1_FINAL, + NULL +}; +static struct fmt_tests _Preloads_102[] = +{ + {"$dynamic_102$7aa81139e7678b70751524388e364b64a8f68d08d51ef869c7cb00597246a3a5800af869a736da110836835e67b600936e6cb98004918a8eda60b7c529d420f7$Wdw73yeZ","test1"}, + {"$dynamic_102$ec8ac0ab32650a2a9cf361b4743d0eda196868ce09c374ba59ed35122f88d184d4a4634e82579d98a54b97333e4c0333e20417b95efded39df453fb5a59f7701$MUf2c3pj","thatsworking"}, + {"$dynamic_102$94bb2261deb52f06034106e7c61fdc121cfedcab468b97683b0baf46a3047b9b3da3440a478a1059b7b95a2206bb2a51d61ccfad6a684f1d44dce2b741ebfa10$xr57dTTr","test3"}, + {NULL} +}; +#endif + // Here is a 'dummy' constant array. This will be 'linked' to any dynamic format that does not have any constants. static DYNAMIC_Constants _ConstDefault[] = { @@ -1374,6 +1463,12 @@ static DYNAMIC_Setup Setups[] = { "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 }, +#if OPENSSL_VERSION_NUMBER >= 0x10000000 + // Try to group WHIRLPOOL here (from dyna-100 to dyna-110) + { "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 }, +#endif }; char *dynamic_PRELOAD_SIGNATURE(int cnt) @@ -1407,16 +1502,16 @@ int dynamic_RESERVED_PRELOAD_SETUP(int c return dynamic_SETUP(&Setups[cnt], pFmt); } -// -1 is NOT valid +// -1 is NOT valid ( num > 5000 is 'hidden' values ) // 0 is valid, but NOT usable by this build (i.e. no SSE2) // 1 is valid. int dynamic_IS_VALID(int i) { char Type[20]; sprintf(Type, "dynamic_%d", i); - if (i < 0 || (i > 100 && i < 1000) || i > 2000) + if (i < 0 || i > 5000) return -1; - if (i < 1000 && i >= ARRAY_COUNT(Setups)) { + if (i < 1000) { int j,len; len=strlen(Type); for (j = 0; j < ARRAY_COUNT(Setups); ++j) { @@ -1425,11 +1520,7 @@ int dynamic_IS_VALID(int i) } return -1; } - if (i >= 1000) { - if (!dynamic_IS_PARSER_VALID(i)) - return 0; - return 1; - } - + if (!dynamic_IS_PARSER_VALID(i)) + return 0; return 1; } diff -urpN jumbo-bleed2/src/dynamic_utils.c jumbo-bleed1/src/dynamic_utils.c --- jumbo-bleed2/src/dynamic_utils.c 2012-07-17 16:14:27.937500000 +0000 +++ jumbo-bleed1/src/dynamic_utils.c 2012-07-17 16:16:25.890625000 +0000 @@ -1,6 +1,6 @@ /* * This software was written by Jim Fougeron jfoug AT cox dot net - * in 2009. No copyright is claimed, and the software is hereby + * in 2009-2012. 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 � 2009 Jim Fougeron @@ -12,14 +12,15 @@ * * Generic MD5 hashes cracker * - * Preloaded types md5gen(0) to md5gen(100) are 'reserved' types. + * Preloaded types dynamic_0 to dynamic_999 are 'reserved' types. * They are loaded from this file. If someone tryes to build a 'custom' * type in their john.ini file using one of those, john will abort * the run. * * 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 */ #include @@ -57,7 +58,7 @@ void dynamic_DISPLAY_ALL_FORMATS() cfg_init(CFG_FULL_NAME, 1); cfg_init(CFG_ALT_NAME, 0); - for (i = 1001; i < 10000; ++i) + for (i = 1000; i < 10000; ++i) { char *sz = dynamic_LOAD_PARSER_SIGNATURE(i); if (sz) diff -urpN jumbo-bleed2/src/formats.h jumbo-bleed1/src/formats.h --- jumbo-bleed2/src/formats.h 2012-07-17 16:14:27.968750000 +0000 +++ jumbo-bleed1/src/formats.h 2012-07-16 17:15:43.781250000 +0000 @@ -16,7 +16,6 @@ #include "misc.h" struct fmt_main; -struct db_password; /* * Default alignment (used unless known) diff -urpN jumbo-bleed2/src/john.c jumbo-bleed1/src/john.c --- jumbo-bleed2/src/john.c 2012-07-17 16:14:28.156250000 +0000 +++ jumbo-bleed1/src/john.c 2012-07-17 15:56:38.125000000 +0000 @@ -94,8 +94,6 @@ extern struct fmt_main fmt_crypt; extern struct fmt_main fmt_trip; extern struct fmt_main fmt_dummy; -extern struct fmt_main fmt_MD5gen; - #if OPENSSL_VERSION_NUMBER >= 0x10000000 extern struct fmt_main fmt_django; #endif diff -urpN jumbo-bleed2/src/nukedclan_fmt_plug.c jumbo-bleed1/src/nukedclan_fmt_plug.c --- jumbo-bleed2/src/nukedclan_fmt_plug.c 2012-07-17 16:14:28.484375000 +0000 +++ jumbo-bleed1/src/nukedclan_fmt_plug.c 2012-07-17 16:03:51.406250000 +0000 @@ -155,7 +155,7 @@ static void crypt_all(int count) #pragma omp parallel for #endif for (index = 0; index < count; index++) { - unsigned char pass[40]; + unsigned char pass[40+1]; unsigned char out[80]; int i; int idx = 0; diff -urpN jumbo-bleed2/src/rawSHA1_ng_fmt.c jumbo-bleed1/src/rawSHA1_ng_fmt.c --- jumbo-bleed2/src/rawSHA1_ng_fmt.c 2012-07-17 16:14:29.078125000 +0000 +++ jumbo-bleed1/src/rawSHA1_ng_fmt.c 2012-07-17 16:15:04.890625000 +0000 @@ -249,7 +249,8 @@ static void * sha1_fmt_binary_full(void static void * sha1_fmt_binary(char *ciphertext) { // Static buffer storing the binary representation of ciphertext. - static uint32_t result[SHA1_DIGEST_WORDS]; + static uint32_t *result = NULL; + if (!result) result = mem_alloc_tiny(SHA1_DIGEST_WORDS*sizeof(uint32_t), 16); // Skip over tag. ciphertext += strlen(kFormatTag);