2015-12-04 14:47:52 +00:00
|
|
|
/**
|
|
|
|
* Author......: Jens Steube <jens.steube@gmail.com>
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define _SHA256_SHA1_
|
|
|
|
|
|
|
|
#include "include/constants.h"
|
|
|
|
#include "include/kernel_vendor.h"
|
|
|
|
|
|
|
|
#define DGST_R0 3
|
|
|
|
#define DGST_R1 7
|
|
|
|
#define DGST_R2 2
|
|
|
|
#define DGST_R3 6
|
|
|
|
|
|
|
|
#include "include/kernel_functions.c"
|
2016-01-03 00:48:05 +00:00
|
|
|
#include "OpenCL/types_ocl.c"
|
|
|
|
#include "OpenCL/common.c"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-03 00:48:05 +00:00
|
|
|
#define COMPARE_S "OpenCL/check_single_comp4.c"
|
|
|
|
#define COMPARE_M "OpenCL/check_multi_comp4.c"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#define uint_to_hex_upper8(i) l_bin2asc[(i)]
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
static void m12600m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, __local u32 l_bin2asc[256])
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* salt
|
|
|
|
*/
|
|
|
|
|
|
|
|
u32 pc256[8];
|
|
|
|
|
|
|
|
pc256[0] = salt_bufs[salt_pos].salt_buf_pc[0];
|
|
|
|
pc256[1] = salt_bufs[salt_pos].salt_buf_pc[1];
|
|
|
|
pc256[2] = salt_bufs[salt_pos].salt_buf_pc[2];
|
|
|
|
pc256[3] = salt_bufs[salt_pos].salt_buf_pc[3];
|
|
|
|
pc256[4] = salt_bufs[salt_pos].salt_buf_pc[4];
|
|
|
|
pc256[5] = salt_bufs[salt_pos].salt_buf_pc[5];
|
|
|
|
pc256[6] = salt_bufs[salt_pos].salt_buf_pc[6];
|
|
|
|
pc256[7] = salt_bufs[salt_pos].salt_buf_pc[7];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0l = w0[0];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
|
|
|
{
|
|
|
|
const u32 w0r = bfs_buf[il_pos].i;
|
|
|
|
|
|
|
|
w0[0] = w0l | w0r;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1
|
|
|
|
*/
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0_t = w0[0];
|
|
|
|
u32 w1_t = w0[1];
|
|
|
|
u32 w2_t = w0[2];
|
|
|
|
u32 w3_t = w0[3];
|
|
|
|
u32 w4_t = w1[0];
|
|
|
|
u32 w5_t = w1[1];
|
|
|
|
u32 w6_t = w1[2];
|
|
|
|
u32 w7_t = w1[3];
|
|
|
|
u32 w8_t = w2[0];
|
|
|
|
u32 w9_t = w2[1];
|
|
|
|
u32 wa_t = w2[2];
|
|
|
|
u32 wb_t = w2[3];
|
|
|
|
u32 wc_t = w3[0];
|
|
|
|
u32 wd_t = w3[1];
|
|
|
|
u32 we_t = 0;
|
|
|
|
u32 wf_t = pw_len * 8;
|
|
|
|
|
|
|
|
u32 a = SHA1M_A;
|
|
|
|
u32 b = SHA1M_B;
|
|
|
|
u32 c = SHA1M_C;
|
|
|
|
u32 d = SHA1M_D;
|
|
|
|
u32 e = SHA1M_E;
|
|
|
|
u32 f = 0;
|
|
|
|
u32 g = 0;
|
|
|
|
u32 h = 0;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
|
|
|
|
|
|
|
a += SHA1M_A;
|
|
|
|
b += SHA1M_B;
|
|
|
|
c += SHA1M_C;
|
|
|
|
d += SHA1M_D;
|
|
|
|
e += SHA1M_E;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha256
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = uint_to_hex_upper8 ((a >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((a >> 16) & 255) << 16;
|
|
|
|
w1_t = uint_to_hex_upper8 ((a >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((a >> 0) & 255) << 16;
|
|
|
|
w2_t = uint_to_hex_upper8 ((b >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((b >> 16) & 255) << 16;
|
|
|
|
w3_t = uint_to_hex_upper8 ((b >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((b >> 0) & 255) << 16;
|
|
|
|
w4_t = uint_to_hex_upper8 ((c >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((c >> 16) & 255) << 16;
|
|
|
|
w5_t = uint_to_hex_upper8 ((c >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((c >> 0) & 255) << 16;
|
|
|
|
w6_t = uint_to_hex_upper8 ((d >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((d >> 16) & 255) << 16;
|
|
|
|
w7_t = uint_to_hex_upper8 ((d >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((d >> 0) & 255) << 16;
|
|
|
|
w8_t = uint_to_hex_upper8 ((e >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((e >> 16) & 255) << 16;
|
|
|
|
w9_t = uint_to_hex_upper8 ((e >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((e >> 0) & 255) << 16;
|
|
|
|
|
2015-12-15 15:50:21 +00:00
|
|
|
w0_t = swap32 (w0_t);
|
|
|
|
w1_t = swap32 (w1_t);
|
|
|
|
w2_t = swap32 (w2_t);
|
|
|
|
w3_t = swap32 (w3_t);
|
|
|
|
w4_t = swap32 (w4_t);
|
|
|
|
w5_t = swap32 (w5_t);
|
|
|
|
w6_t = swap32 (w6_t);
|
|
|
|
w7_t = swap32 (w7_t);
|
|
|
|
w8_t = swap32 (w8_t);
|
|
|
|
w9_t = swap32 (w9_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
wa_t = 0x80000000;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = (64 + 40) * 8;
|
|
|
|
|
|
|
|
a = pc256[0];
|
|
|
|
b = pc256[1];
|
|
|
|
c = pc256[2];
|
|
|
|
d = pc256[3];
|
|
|
|
e = pc256[4];
|
|
|
|
f = pc256[5];
|
|
|
|
g = pc256[6];
|
|
|
|
h = pc256[7];
|
|
|
|
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C00);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C01);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C02);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C03);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C04);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C05);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C06);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C07);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C08);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C09);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C0a);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C0b);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C0c);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C0d);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C0e);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C0f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C10);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C11);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C12);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C13);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C14);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C15);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C16);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C17);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C18);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C19);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C1a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C1b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C1c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C1d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C1e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C1f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C20);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C21);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C22);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C23);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C24);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C25);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C26);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C27);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C28);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C29);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C2a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C2b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C2c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C2d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C2e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C2f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C30);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C31);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C32);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C33);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C34);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C35);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C36);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C37);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C38);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C39);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C3a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C3b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C3c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C3d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C3e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C3f);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
const u32 r0 = d;
|
|
|
|
const u32 r1 = h;
|
|
|
|
const u32 r2 = c;
|
|
|
|
const u32 r3 = g;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
#include COMPARE_M
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
static void m12600s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, __local u32 l_bin2asc[256])
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* digest
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 search[4] =
|
|
|
|
{
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R0],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R1],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R2],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R3]
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* salt
|
|
|
|
*/
|
|
|
|
|
|
|
|
u32 pc256[8];
|
|
|
|
|
|
|
|
pc256[0] = salt_bufs[salt_pos].salt_buf_pc[0];
|
|
|
|
pc256[1] = salt_bufs[salt_pos].salt_buf_pc[1];
|
|
|
|
pc256[2] = salt_bufs[salt_pos].salt_buf_pc[2];
|
|
|
|
pc256[3] = salt_bufs[salt_pos].salt_buf_pc[3];
|
|
|
|
pc256[4] = salt_bufs[salt_pos].salt_buf_pc[4];
|
|
|
|
pc256[5] = salt_bufs[salt_pos].salt_buf_pc[5];
|
|
|
|
pc256[6] = salt_bufs[salt_pos].salt_buf_pc[6];
|
|
|
|
pc256[7] = salt_bufs[salt_pos].salt_buf_pc[7];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0l = w0[0];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
|
|
|
|
{
|
|
|
|
const u32 w0r = bfs_buf[il_pos].i;
|
|
|
|
|
|
|
|
w0[0] = w0l | w0r;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1
|
|
|
|
*/
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0_t = w0[0];
|
|
|
|
u32 w1_t = w0[1];
|
|
|
|
u32 w2_t = w0[2];
|
|
|
|
u32 w3_t = w0[3];
|
|
|
|
u32 w4_t = w1[0];
|
|
|
|
u32 w5_t = w1[1];
|
|
|
|
u32 w6_t = w1[2];
|
|
|
|
u32 w7_t = w1[3];
|
|
|
|
u32 w8_t = w2[0];
|
|
|
|
u32 w9_t = w2[1];
|
|
|
|
u32 wa_t = w2[2];
|
|
|
|
u32 wb_t = w2[3];
|
|
|
|
u32 wc_t = w3[0];
|
|
|
|
u32 wd_t = w3[1];
|
|
|
|
u32 we_t = 0;
|
|
|
|
u32 wf_t = pw_len * 8;
|
|
|
|
|
|
|
|
u32 a = SHA1M_A;
|
|
|
|
u32 b = SHA1M_B;
|
|
|
|
u32 c = SHA1M_C;
|
|
|
|
u32 d = SHA1M_D;
|
|
|
|
u32 e = SHA1M_E;
|
|
|
|
u32 f = 0;
|
|
|
|
u32 g = 0;
|
|
|
|
u32 h = 0;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
|
|
|
|
|
|
|
a += SHA1M_A;
|
|
|
|
b += SHA1M_B;
|
|
|
|
c += SHA1M_C;
|
|
|
|
d += SHA1M_D;
|
|
|
|
e += SHA1M_E;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha256
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = uint_to_hex_upper8 ((a >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((a >> 16) & 255) << 16;
|
|
|
|
w1_t = uint_to_hex_upper8 ((a >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((a >> 0) & 255) << 16;
|
|
|
|
w2_t = uint_to_hex_upper8 ((b >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((b >> 16) & 255) << 16;
|
|
|
|
w3_t = uint_to_hex_upper8 ((b >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((b >> 0) & 255) << 16;
|
|
|
|
w4_t = uint_to_hex_upper8 ((c >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((c >> 16) & 255) << 16;
|
|
|
|
w5_t = uint_to_hex_upper8 ((c >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((c >> 0) & 255) << 16;
|
|
|
|
w6_t = uint_to_hex_upper8 ((d >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((d >> 16) & 255) << 16;
|
|
|
|
w7_t = uint_to_hex_upper8 ((d >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((d >> 0) & 255) << 16;
|
|
|
|
w8_t = uint_to_hex_upper8 ((e >> 24) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((e >> 16) & 255) << 16;
|
|
|
|
w9_t = uint_to_hex_upper8 ((e >> 8) & 255) << 0
|
|
|
|
| uint_to_hex_upper8 ((e >> 0) & 255) << 16;
|
|
|
|
|
2015-12-15 15:50:21 +00:00
|
|
|
w0_t = swap32 (w0_t);
|
|
|
|
w1_t = swap32 (w1_t);
|
|
|
|
w2_t = swap32 (w2_t);
|
|
|
|
w3_t = swap32 (w3_t);
|
|
|
|
w4_t = swap32 (w4_t);
|
|
|
|
w5_t = swap32 (w5_t);
|
|
|
|
w6_t = swap32 (w6_t);
|
|
|
|
w7_t = swap32 (w7_t);
|
|
|
|
w8_t = swap32 (w8_t);
|
|
|
|
w9_t = swap32 (w9_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
wa_t = 0x80000000;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = (64 + 40) * 8;
|
|
|
|
|
|
|
|
a = pc256[0];
|
|
|
|
b = pc256[1];
|
|
|
|
c = pc256[2];
|
|
|
|
d = pc256[3];
|
|
|
|
e = pc256[4];
|
|
|
|
f = pc256[5];
|
|
|
|
g = pc256[6];
|
|
|
|
h = pc256[7];
|
|
|
|
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C00);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C01);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C02);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C03);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C04);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C05);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C06);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C07);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C08);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C09);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C0a);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C0b);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C0c);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C0d);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C0e);
|
|
|
|
SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C0f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C10);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C11);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C12);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C13);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C14);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C15);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C16);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C17);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C18);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C19);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C1a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C1b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C1c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C1d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C1e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C1f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C20);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C21);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C22);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C23);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C24);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C25);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C26);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C27);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C28);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C29);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C2a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C2b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C2c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C2d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C2e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C2f);
|
|
|
|
|
|
|
|
w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C30);
|
|
|
|
w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C31);
|
|
|
|
w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, SHA256C32);
|
|
|
|
w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, SHA256C33);
|
|
|
|
w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, SHA256C34);
|
|
|
|
w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, SHA256C35);
|
|
|
|
w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, SHA256C36);
|
|
|
|
w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, SHA256C37);
|
|
|
|
w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, SHA256C38);
|
|
|
|
w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, SHA256C39);
|
|
|
|
wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, SHA256C3a);
|
|
|
|
wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, SHA256C3b);
|
|
|
|
wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, SHA256C3c);
|
|
|
|
wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, SHA256C3d);
|
|
|
|
we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, SHA256C3e);
|
|
|
|
wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, SHA256C3f);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
const u32 r0 = d;
|
|
|
|
const u32 r1 = h;
|
|
|
|
const u32 r2 = c;
|
|
|
|
const u32 r3 = g;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
#include COMPARE_S
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = 0;
|
|
|
|
w1[1] = 0;
|
|
|
|
w1[2] = 0;
|
|
|
|
w1[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = 0;
|
|
|
|
w2[1] = 0;
|
|
|
|
w2[2] = 0;
|
|
|
|
w2[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = 0;
|
|
|
|
w3[1] = 0;
|
|
|
|
w3[2] = 0;
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = pws[gid].i[ 4];
|
|
|
|
w1[1] = pws[gid].i[ 5];
|
|
|
|
w1[2] = pws[gid].i[ 6];
|
|
|
|
w1[3] = pws[gid].i[ 7];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = 0;
|
|
|
|
w2[1] = 0;
|
|
|
|
w2[2] = 0;
|
|
|
|
w2[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = 0;
|
|
|
|
w3[1] = 0;
|
|
|
|
w3[2] = 0;
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = pws[gid].i[ 4];
|
|
|
|
w1[1] = pws[gid].i[ 5];
|
|
|
|
w1[2] = pws[gid].i[ 6];
|
|
|
|
w1[3] = pws[gid].i[ 7];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = pws[gid].i[ 8];
|
|
|
|
w2[1] = pws[gid].i[ 9];
|
|
|
|
w2[2] = pws[gid].i[10];
|
|
|
|
w2[3] = pws[gid].i[11];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = pws[gid].i[12];
|
|
|
|
w3[1] = pws[gid].i[13];
|
|
|
|
w3[2] = pws[gid].i[14];
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = 0;
|
|
|
|
w1[1] = 0;
|
|
|
|
w1[2] = 0;
|
|
|
|
w1[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = 0;
|
|
|
|
w2[1] = 0;
|
|
|
|
w2[2] = 0;
|
|
|
|
w2[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = 0;
|
|
|
|
w3[1] = 0;
|
|
|
|
w3[2] = 0;
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = pws[gid].i[ 4];
|
|
|
|
w1[1] = pws[gid].i[ 5];
|
|
|
|
w1[2] = pws[gid].i[ 6];
|
|
|
|
w1[3] = pws[gid].i[ 7];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = 0;
|
|
|
|
w2[1] = 0;
|
|
|
|
w2[2] = 0;
|
|
|
|
w2[3] = 0;
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = 0;
|
|
|
|
w3[1] = 0;
|
|
|
|
w3[2] = 0;
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|
|
|
|
|
2016-01-05 07:26:44 +00:00
|
|
|
__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12600_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 gid = get_global_id (0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 lid = get_local_id (0);
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w0[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = pws[gid].i[ 0];
|
|
|
|
w0[1] = pws[gid].i[ 1];
|
|
|
|
w0[2] = pws[gid].i[ 2];
|
|
|
|
w0[3] = pws[gid].i[ 3];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w1[0] = pws[gid].i[ 4];
|
|
|
|
w1[1] = pws[gid].i[ 5];
|
|
|
|
w1[2] = pws[gid].i[ 6];
|
|
|
|
w1[3] = pws[gid].i[ 7];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w2[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w2[0] = pws[gid].i[ 8];
|
|
|
|
w2[1] = pws[gid].i[ 9];
|
|
|
|
w2[2] = pws[gid].i[10];
|
|
|
|
w2[3] = pws[gid].i[11];
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w3[0] = pws[gid].i[12];
|
|
|
|
w3[1] = pws[gid].i[13];
|
|
|
|
w3[2] = pws[gid].i[14];
|
|
|
|
w3[3] = pws[gid].i[15];
|
|
|
|
|
|
|
|
const u32 pw_len = pws[gid].pw_len;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bin2asc table
|
|
|
|
*/
|
|
|
|
|
|
|
|
__local u32 l_bin2asc[256];
|
|
|
|
|
|
|
|
const u32 lid4 = lid * 4;
|
|
|
|
|
|
|
|
const u32 lid40 = lid4 + 0;
|
|
|
|
const u32 lid41 = lid4 + 1;
|
|
|
|
const u32 lid42 = lid4 + 2;
|
|
|
|
const u32 lid43 = lid4 + 3;
|
|
|
|
|
|
|
|
const u32 v400 = (lid40 >> 0) & 15;
|
|
|
|
const u32 v401 = (lid40 >> 4) & 15;
|
|
|
|
const u32 v410 = (lid41 >> 0) & 15;
|
|
|
|
const u32 v411 = (lid41 >> 4) & 15;
|
|
|
|
const u32 v420 = (lid42 >> 0) & 15;
|
|
|
|
const u32 v421 = (lid42 >> 4) & 15;
|
|
|
|
const u32 v430 = (lid43 >> 0) & 15;
|
|
|
|
const u32 v431 = (lid43 >> 4) & 15;
|
|
|
|
|
|
|
|
l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
|
|
|
|
| ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
|
|
|
|
l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
|
|
|
|
| ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
|
|
|
|
l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
|
|
|
|
| ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
|
|
|
|
l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
|
|
|
|
| ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
|
|
|
|
|
|
|
|
barrier (CLK_LOCAL_MEM_FENCE);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* main
|
|
|
|
*/
|
|
|
|
|
|
|
|
m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, l_bin2asc);
|
|
|
|
}
|