static void find_best_gws(struct fmt_main *fmt) {
	struct timeval 	start,end ;
	double 		savetime, diff ;
	size_t	 	count = local_work_size;
	double 		speed = 999999 ;
	BF_salt 	random_salt ;

	random_salt.salt[0] = 0x12345678 ;
	random_salt.salt[1] = 0x87654321 ;
	random_salt.salt[2] = 0x21876543 ;
	random_salt.salt[3] = 0x98765432 ;
	random_salt.rounds  = 5 ;
	random_salt.subtype = 'x' ;

	gettimeofday(&start,NULL) ;
	opencl_BF_std_crypt(&random_salt,count) ;
	gettimeofday(&end, NULL) ;
	savetime = (end.tv_sec - start.tv_sec) + (double)(end.tv_usec - start.tv_usec) / 1000000.000;
	speed = ((double)count) / savetime ;

	do {
		count *= 2 ;
		if (count > BF_N) {
			count = count >> 1 ;
			break ;
		}
		gettimeofday(&start,NULL) ;
		opencl_BF_std_crypt(&random_salt,count) ;
		gettimeofday(&end, NULL) ;
		savetime = (end.tv_sec - start.tv_sec) + (double)(end.tv_usec - start.tv_usec) / 1000000.000 ;
		diff = (((double)count) / savetime) / speed ;
		if (diff < 1) {
		  count = count	>> 1 ;
		  break ;
		}
示例#2
0
static void crypt_all(int count)
{
	if (keys_mode != saved_salt.subtype) {
		int i;

		keys_mode = saved_salt.subtype;
		sign_extension_bug = (keys_mode == 'x');
		for (i = 0; i < count; i++)
			opencl_BF_std_set_key(saved_key[i], i, sign_extension_bug);
	}

	opencl_BF_std_crypt(&saved_salt, count);
}
static int crypt_all(int *pcount, struct db_salt *salt) {
	const int count = *pcount ;
	if (keys_mode != saved_salt.subtype) {
		int i ;

		keys_mode = saved_salt.subtype ;
		sign_extension_bug = (keys_mode == 'x');
		for (i = 0; i < count; i++)
			opencl_BF_std_set_key(saved_key[i], i, sign_extension_bug) ;
	}

	opencl_BF_std_crypt(&saved_salt, count) ;
	return count ;
}