
/*****************************************************************************
 ****  #{HASH} functions This code generated from dynamic_big_crypt_hash.cin
 ****  !!!!!!!!!!!!DO NOT edit the code in this generated file!!!!!!!!!!!!!!
 ****  It is regenerated at make time, so changes to this file will be lost.
 ****  Any issues found MUST be fixed properly in dynamic_big_crypt_hash.cin
 ****  and not in this file. Then make regenerates this file with the fixes.
 ****************************************************************************/
#ifdef SIMD_PARA_#{PARAHASH}
#define #{HASH}_LOOPS (SIMD_COEF_#{BITS}*SIMD_PARA_#{PARAHASH})
static const uint32_t #{HASH}_inc = #{HASH}_LOOPS;

static void Do#{HASH}_crypt_f_sse(void *in, uint32_t len[#{HASH}_LOOPS], void *out) {
	JTR_ALIGN(MEM_ALIGN_SIMD) uint#{BITS}_t a[(#{BIN_SZ}*#{HASH}_LOOPS)/sizeof(uint#{BITS}_t)];
	uint32_t i, j, loops[#{HASH}_LOOPS], bMore, cnt;
#ifndef TRUNC_TO16
//	uint32_t max_cnt=0;
#endif  // !defined TRUNC_TO16
	unsigned char *cp = (unsigned char*)in;
	for (i = 0; i < #{HASH}_LOOPS; ++i) {
		loops[i] = Do_FixBufferLen#{BITS}(cp, len[i], #{BE_HASH});
#ifndef TRUNC_TO16
//		if (max_cnt < loops[i]) max_cnt = loops[1];
#endif  // !defined TRUNC_TO16
		cp += 64*4;
	}
	cp = (unsigned char*)in;
#ifndef TRUNC_TO16
//	if (max_cnt==1) { #{SSEBody}(cp, out, out, SSEi_FLAT_IN#{SSEFLAGS}|SSEi_#{SSE_LIMBS}BUF_INPUT|SSEi_FLAT_OUT); return; }
#endif  // !defined TRUNC_TO16
	bMore = 1;
	cnt = 1;
	while (bMore) {
		#{SSEBody}(cp, a, a, SSEi_FLAT_IN#{SSEFLAGS}|SSEi_#{SSE_LIMBS}BUF_INPUT_FIRST_BLK|(cnt==1?0:SSEi_RELOAD));
		bMore = 0;
		for (i = 0; i < #{HASH}_LOOPS; ++i) {
			if (cnt == loops[i]) {
				uint32_t offx = ((i/SIMD_COEF_#{BITS})*(#{BIN_SZ}/sizeof(uint#{BITS}_t))*SIMD_COEF_#{BITS})+(i&(SIMD_COEF_#{BITS}-1));
#ifdef TRUNC_TO16
				// only 16 bytes in the 'final'
#endif  // defined TRUNC_TO16
				for (j = 0; j < 16/sizeof(uint#{BITS}_t); ++j) {
					((uint#{BITS}_t*)out)[(i*#{SSE_LIMBS})+j] = #{JSWAPH}a[(j*SIMD_COEF_#{BITS})+offx]#{JSWAPT}
				}
			} else if (cnt < loops[i]) bMore = 1;
		}
		cp += #{BITS}*2; ++cnt;
	}
}

static void Do#{HASH}_crypt_sse(void *in, uint32_t ilen[#{HASH}_LOOPS], void *out[#{HASH}_LOOPS], uint32_t *tot_len, uint32_t tid) {
	JTR_ALIGN(MEM_ALIGN_SIMD) uint#{BITS}_t a[(#{BIN_SZ}*#{HASH}_LOOPS)/sizeof(uint#{BITS}_t)];
	union yy { unsigned char u[#{BIN_SZ}]; uint#{BITS}_t a[#{BIN_SZ}/sizeof(uint#{BITS}_t)]; } y;
	uint32_t i, j, loops[#{HASH}_LOOPS], bMore, cnt;
	unsigned char *cp = (unsigned char*)in;
	for (i = 0; i < #{HASH}_LOOPS; ++i) {
		loops[i] = Do_FixBufferLen#{BITS}(cp, ilen[i], #{BE_HASH});
		cp += 64*4;
	}
	cp = (unsigned char*)in; bMore = 1; cnt = 1;
	while (bMore) {
		#{SSEBody}(cp, a, a, SSEi_FLAT_IN#{SSEFLAGS}|SSEi_#{SSE_LIMBS}BUF_INPUT_FIRST_BLK|(cnt==1?0:SSEi_RELOAD));
		bMore = 0;
		for (i = 0; i < #{HASH}_LOOPS; ++i) {
			if (cnt == loops[i]) {
				uint32_t offx = ((i/SIMD_COEF_#{BITS})*#{BIN_SZ}/sizeof(uint#{BITS}_t)*SIMD_COEF_#{BITS})+(i&(SIMD_COEF_#{BITS}-1));
				for (j = 0; j < #{BIN_SZ}/sizeof(uint#{BITS}_t); ++j) {
					y.a[j] = #{JSWAPH}a[(j*SIMD_COEF_#{BITS})+offx]#{JSWAPT}
				}
				*(tot_len+i) += large_hash_output(y.u, &(((unsigned char*)out[i])[*(tot_len+i)]), #{BIN_REAL_SZ}, tid);
			} else if (cnt < loops[i]) bMore = 1;
		}
		cp += #{BITS}*2; ++cnt;
	}
}

inline static void Do#{HASH}_sse_crypt_only(void *in, uint32_t len[#{HASH}_LOOPS], void *out) {
	JTR_ALIGN(MEM_ALIGN_SIMD) uint#{BITS}_t a[(#{BIN_SZ}*#{HASH}_LOOPS)/sizeof(uint#{BITS}_t)];
	uint32_t i, j, loops[#{HASH}_LOOPS], bMore, cnt;
	unsigned char *cp = (unsigned char*)in;
	for (i = 0; i < #{HASH}_LOOPS; ++i) {
		loops[i] = Do_FixBufferLen#{BITS}(cp, len[i], #{BE_HASH});
		cp += 64*4;
	}
	cp = (unsigned char*)in; bMore = 1; cnt = 1;
	while (bMore) {
		#{SSEBody}(cp, a, a, SSEi_FLAT_IN#{SSEFLAGS}|SSEi_OUTPUT_AS_#{SSE_ONLY_LIMBS}INP_FMT|SSEi_#{SSE_LIMBS}BUF_INPUT_FIRST_BLK|(cnt==1?0:SSEi_RELOAD));
		bMore = 0;
		for (i = 0; i < #{HASH}_LOOPS; ++i) {
			if (cnt == loops[i]) {
				uint32_t offx = ((i/SIMD_COEF_#{BITS})*(#{BIN_SZ}/sizeof(uint#{BITS}_t))*SIMD_COEF_#{BITS})+(i&(SIMD_COEF_#{BITS}-1));
				for (j = 0; j < #{BIN_SZ}/sizeof(uint#{BITS}_t); ++j) {
					((uint#{BITS}_t*)out)[(i*#{SSE_LIMBS})+j] = #{JSWAPH}a[(j*SIMD_COEF_#{BITS})+offx]#{JSWAPT}
				}
			} else if (cnt < loops[i])
				bMore = 1;
		}
		cp += #{BITS}*2;
		++cnt;
	}
}

#else  // defined SIMD_PARA_#{PARAHASH}
#define #{HASH}_LOOPS 1
static const uint32_t #{HASH}_inc = 1;

inline static void Do#{HASH}_crypt_f(void *in, uint32_t len, void *out) {
#ifdef TRUNC_TO16
	union xx { unsigned char u[#{BIN_SZ}]; uint#{BITS}_t a[#{BIN_SZ}/sizeof(uint#{BITS}_t)]; } u;
	unsigned char *crypt_out=u.u;
#else  // defined TRUNC_TO16
	unsigned char *crypt_out=(unsigned char*)out;
#endif  // defined TRUNC_TO16
	#{HASH_CTX} ctx;
	#{HASH_Init}(&ctx);
	#{HASH_Update}(&ctx, in, len);
	#{HASH_Final}(crypt_out, &ctx);
#ifdef TRUNC_TO16
	memcpy(out, crypt_out, 16);
#endif  // defined TRUNC_TO16
}

inline static void Do#{HASH}_crypt(void *in, uint32_t ilen, void *out, uint32_t *tot_len, uint32_t tid) {
	unsigned char crypt_out[#{BIN_SZ}];
	#{HASH_CTX} ctx;
	#{HASH_Init}(&ctx);
	#{HASH_Update}(&ctx, in, ilen);
	#{HASH_Final}(crypt_out, &ctx);
	if (eLargeOut_get(tid) == eBase16) {
		// since this is the usual, we avoid the extra overhead of large_hash_output, and go directly to the hex_out.
		hex_out_buf(crypt_out, &(((unsigned char*)out)[*tot_len]), #{BIN_REAL_SZ});
		*tot_len += #{BIN_REAL_SZ}*2;
	} else
		*tot_len += large_hash_output(crypt_out, &(((unsigned char*)out)[*tot_len]), #{BIN_REAL_SZ}, tid);
}
inline static void Do#{HASH}_crypt_only(void *in, uint32_t ilen, void *out)
{
	#{HASH_CTX} ctx;
	#{HASH_Init}(&ctx);
	#{HASH_Update}(&ctx, in, ilen);
	#{HASH_Final}(out, &ctx);
}
#endif  // defined SIMD_PARA_#{PARAHASH}

void DynamicFunc__#{HASH}_crypt_input1_append_input2(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x1.b;
		}
		Do#{HASH}_crypt_sse(input_buf_X86[i>>MD5_X2].x1.b, len, out, &(total_len2_X86[i]), tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x2.b2, &(total_len2_X86[i]), tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x1.b, &(total_len2_X86[i]), tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_append_input1(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len2_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x1.b;
		}
		Do#{HASH}_crypt_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, out, &(total_len_X86[i]), tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x2.b2, &(total_len_X86[i]), tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x1.b, &(total_len_X86[i]), tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input1_at_offset_input2(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = nLargeOff_get(tid);
		}
		Do#{HASH}_crypt_sse(input_buf_X86[i>>MD5_X2].x1.b, len, out, x, tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = nLargeOff_get(tid);
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x1.b, &x, tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_at_offset_input1(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len2_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = nLargeOff_get(tid);
		}
		Do#{HASH}_crypt_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, out, x, tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = nLargeOff_get(tid);
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x1.b, &x, tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input1_at_offset_input1(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = nLargeOff_get(tid);
		}
		Do#{HASH}_crypt_sse(input_buf_X86[i>>MD5_X2].x1.b, len, out, x, tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = nLargeOff_get(tid);
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], input_buf_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], input_buf_X86[i>>MD5_X2].x1.b, &x, tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_at_offset_input2(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len2_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = nLargeOff_get(tid);
		}
		Do#{HASH}_crypt_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, out, x, tid);
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = nLargeOff_get(tid);
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], input_buf2_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], input_buf2_X86[i>>MD5_X2].x1.b, &x, tid);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input1_overwrite_input1(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = 0;
		}
		Do#{HASH}_crypt_sse(input_buf_X86[i>>MD5_X2].x1.b, len, out, x, tid);
		for (j = 0; j < #{HASH}_LOOPS; ++j)
			total_len_X86[i+j] = x[j];
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = 0;
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], input_buf_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], input_buf_X86[i>>MD5_X2].x1.b, &x, tid);
		total_len_X86[i] = x;
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input1_overwrite_input2(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = 0;
		}
		Do#{HASH}_crypt_sse(input_buf_X86[i>>MD5_X2].x1.b, len, out, x, tid);
		for (j = 0; j < #{HASH}_LOOPS; ++j)
			total_len2_X86[i+j] = x[j];
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = 0;
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], input_buf2_X86[i>>MD5_X2].x1.b, &x, tid);
		total_len2_X86[i] = x;
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_overwrite_input1(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len2_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = 0;
		}
		Do#{HASH}_crypt_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, out, x, tid);
		for (j = 0; j < #{HASH}_LOOPS; ++j)
			total_len_X86[i+j] = x[j];
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = 0;
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], input_buf_X86[i>>MD5_X2].x1.b, &x, tid);
		total_len_X86[i] = x;
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_overwrite_input2(DYNA_OMP_PARAMS) {
	PRELIM_W_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		uint32_t j, len[#{HASH}_LOOPS], x[#{HASH}_LOOPS];
		void *out[#{HASH}_LOOPS];
		for (j = 0; j < #{HASH}_LOOPS; ++j) {
			len[j] = total_len2_X86[i+j];
			#if (MD5_X2)
			if (j&1)
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x2.b2;
			else
			#endif
				out[j] = input_buf2_X86[(i+j)>>MD5_X2].x1.b;
			x[j] = 0;
		}
		Do#{HASH}_crypt_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, out, x, tid);
		for (j = 0; j < #{HASH}_LOOPS; ++j)
			total_len2_X86[i+j] = x[j];
#else  // defined SIMD_PARA_#{PARAHASH}
		uint32_t x = 0;
		#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], input_buf2_X86[i>>MD5_X2].x2.b2, &x, tid);
		else
		#endif
		Do#{HASH}_crypt(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], input_buf2_X86[i>>MD5_X2].x1.b, &x, tid);
		total_len2_X86[i] = x;
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

inline static void _Dyna__#{HASH}_crypt_inputX_to_outputY(uint32_t X, uint32_t Y, uint32_t i, uint32_t til) {
	dynamic_BHO[--Y].width = #{BIN_REAL_SZ}; // Y was 1 based for ease of reading.
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
		dynamic_BHO[Y].BE = #{BE_HASH};
		dynamic_BHO[Y].bits = #{BITS};
		dynamic_BHO[Y].mixed_SIMD=1;
		if (X==1) {
			Do#{HASH}_sse_crypt_only(input_buf_X86[i>>MD5_X2].x1.b, &total_len_X86[i], dynamic_BHO[Y].dat[i].b);
		} else {
			Do#{HASH}_sse_crypt_only(input_buf2_X86[i>>MD5_X2].x1.b, &total_len2_X86[i], dynamic_BHO[Y].dat[i].b);
		}
#else  // defined SIMD_PARA_#{PARAHASH}
		dynamic_BHO[Y].BE = 0;	// CTX requires no swapping.
		dynamic_BHO[Y].bits = #{BITS};
		dynamic_BHO[Y].mixed_SIMD=0;
		if (X==1) {
			#if (MD5_X2)
			if (i & 1)
				Do#{HASH}_crypt_only(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], dynamic_BHO[Y].dat[i].b);
			else
			#endif
			Do#{HASH}_crypt_only(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], dynamic_BHO[Y].dat[i].b);
		} else {
			#if (MD5_X2)
			if (i & 1)
				Do#{HASH}_crypt_only(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], dynamic_BHO[Y].dat[i].b);
			else
			#endif
			Do#{HASH}_crypt_only(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], dynamic_BHO[Y].dat[i].b);
		}
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}
void DynamicFunc__#{HASH}_crypt_input1_to_output1(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(1, 1, i, til); }
void DynamicFunc__#{HASH}_crypt_input1_to_output2(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(1, 2, i, til); }
void DynamicFunc__#{HASH}_crypt_input1_to_output3(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(1, 3, i, til); }
void DynamicFunc__#{HASH}_crypt_input1_to_output4(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(1, 4, i, til); }
void DynamicFunc__#{HASH}_crypt_input2_to_output1(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(2, 1, i, til); }
void DynamicFunc__#{HASH}_crypt_input2_to_output2(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(2, 2, i, til); }
void DynamicFunc__#{HASH}_crypt_input2_to_output3(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(2, 3, i, til); }
void DynamicFunc__#{HASH}_crypt_input2_to_output4(DYNA_OMP_PARAMS) { PRELIM_NO_TID; _Dyna__#{HASH}_crypt_inputX_to_outputY(2, 4, i, til); }

void DynamicFunc__#{HASH}_crypt_input1_to_output1_FINAL(DYNA_OMP_PARAMS) {
	PRELIM_NO_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
	uint32_t j, len[#{HASH}_LOOPS];
	for (j = 0; j < #{HASH}_LOOPS; ++j)
		len[j] = total_len_X86[i+j];
	Do#{HASH}_crypt_f_sse(input_buf_X86[i>>MD5_X2].x1.b, len, crypt_key_X86[i>>MD5_X2].x1.b);
#else  // defined SIMD_PARA_#{PARAHASH}
	#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt_f(input_buf_X86[i>>MD5_X2].x2.b2, total_len_X86[i], crypt_key_X86[i>>MD5_X2].x2.b2);
		else
	#endif
		Do#{HASH}_crypt_f(input_buf_X86[i>>MD5_X2].x1.b, total_len_X86[i], crypt_key_X86[i>>MD5_X2].x1.b);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}

void DynamicFunc__#{HASH}_crypt_input2_to_output1_FINAL(DYNA_OMP_PARAMS) {
	PRELIM_NO_TID;
	for (; i < til; i += #{HASH}_inc) {
#ifdef SIMD_PARA_#{PARAHASH}
	uint32_t j, len[#{HASH}_LOOPS];
	for (j = 0; j < #{HASH}_LOOPS; ++j)
		len[j] = total_len2_X86[i+j];
	Do#{HASH}_crypt_f_sse(input_buf2_X86[i>>MD5_X2].x1.b, len, crypt_key_X86[i>>MD5_X2].x1.b);
#else  // defined SIMD_PARA_#{PARAHASH}
	#if (MD5_X2)
		if (i & 1)
			Do#{HASH}_crypt_f(input_buf2_X86[i>>MD5_X2].x2.b2, total_len2_X86[i], crypt_key_X86[i>>MD5_X2].x2.b2);
		else
	#endif
		Do#{HASH}_crypt_f(input_buf2_X86[i>>MD5_X2].x1.b, total_len2_X86[i], crypt_key_X86[i>>MD5_X2].x1.b);
#endif  // defined SIMD_PARA_#{PARAHASH}
	}
}
