#define _CRT_SECURE_NO_WARNINGS #include "sha256.h" static cl_platform_id platform_id = NULL; static cl_device_id device_id = NULL; static cl_uint ret_num_devices; static cl_uint ret_num_platforms; static cl_context context; static cl_int ret; static char* source_str; static size_t source_size; static cl_program program; static cl_kernel kernel; static cl_command_queue command_queue; static cl_mem pinned_saved_keys, pinned_partial_hashes, buffer_out, buffer_keys, data_info; static cl_uint *partial_hashes; static cl_uint *res_hashes; static char *saved_plain; static unsigned int datai[3]; static int have_full_hashes; static size_t kpc = 4; static size_t global_work_size=3; static size_t local_work_size=1; static size_t string_len; void load_source(); void createDevice(); void createkernel(); void create_clobj(); void crypt_all(); void sha256_init(size_t user_kpc) { kpc = user_kpc; load_source(); createDevice(); createkernel(); create_clobj(); } void sha256_crypt(char input[], char* output) { int i; string_len = strlen(input); global_work_size = 3; datai[0] = SHA256_PLAINTEXT_LENGTH; datai[1] = global_work_size; datai[2] = string_len; memcpy(saved_plain, input, string_len+1); crypt_all(); for(i=0; i