2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * magnum <john.magnum@hushmail.com>
12 #include "inc_vendor.cl"
13 #include "inc_hash_constants.h"
14 #include "inc_hash_functions.cl"
15 #include "inc_types.cl"
16 #include "inc_common.cl"
19 #include "inc_simd.cl"
22 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i)])
24 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
26 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
28 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7])
30 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7], l_bin2asc[(i).s8], l_bin2asc[(i).s9], l_bin2asc[(i).sa], l_bin2asc[(i).sb], l_bin2asc[(i).sc], l_bin2asc[(i).sd], l_bin2asc[(i).se], l_bin2asc[(i).sf])
33 void sha1_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[5])
61 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w0_t);
62 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w1_t);
63 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w2_t);
64 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w3_t);
65 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w4_t);
66 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w5_t);
67 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w6_t);
68 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w7_t);
69 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w8_t);
70 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w9_t);
71 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wa_t);
72 SHA1_STEP (SHA1_F0o, E, A, B, C, D, wb_t);
73 SHA1_STEP (SHA1_F0o, D, E, A, B, C, wc_t);
74 SHA1_STEP (SHA1_F0o, C, D, E, A, B, wd_t);
75 SHA1_STEP (SHA1_F0o, B, C, D, E, A, we_t);
76 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wf_t);
77 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, E, A, B, C, D, w0_t);
78 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, D, E, A, B, C, w1_t);
79 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, C, D, E, A, B, w2_t);
80 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, B, C, D, E, A, w3_t);
85 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w4_t);
86 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w5_t);
87 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w6_t);
88 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w7_t);
89 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w8_t);
90 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w9_t);
91 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wa_t);
92 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wb_t);
93 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wc_t);
94 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wd_t);
95 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, we_t);
96 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wf_t);
97 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w0_t);
98 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w1_t);
99 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w2_t);
100 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w3_t);
101 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w4_t);
102 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w5_t);
103 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w6_t);
104 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w7_t);
109 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w8_t);
110 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w9_t);
111 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wa_t);
112 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wb_t);
113 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wc_t);
114 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, wd_t);
115 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, we_t);
116 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wf_t);
117 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w0_t);
118 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w1_t);
119 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w2_t);
120 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w3_t);
121 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w4_t);
122 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w5_t);
123 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w6_t);
124 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w7_t);
125 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w8_t);
126 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w9_t);
127 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wa_t);
128 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wb_t);
133 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wc_t);
134 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wd_t);
135 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, we_t);
136 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wf_t);
137 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w0_t);
138 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w1_t);
139 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w2_t);
140 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w3_t);
141 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w4_t);
142 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w5_t);
143 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w6_t);
144 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w7_t);
145 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w8_t);
146 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w9_t);
147 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wa_t);
148 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wb_t);
149 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wc_t);
150 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wd_t);
151 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, we_t);
152 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wf_t);
161 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
167 const u32 gid = get_global_id (0);
168 const u32 lid = get_local_id (0);
169 const u32 lsz = get_local_size (0);
175 __local u32 l_bin2asc[256];
177 for (u32 i = lid; i < 256; i += lsz)
179 const u32 i0 = (i >> 0) & 15;
180 const u32 i1 = (i >> 4) & 15;
182 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
183 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
186 barrier (CLK_LOCAL_MEM_FENCE);
188 if (gid >= gid_max) return;
197 pw_buf0[0] = pws[gid].i[0];
198 pw_buf0[1] = pws[gid].i[1];
199 pw_buf0[2] = pws[gid].i[2];
200 pw_buf0[3] = pws[gid].i[3];
201 pw_buf1[0] = pws[gid].i[4];
202 pw_buf1[1] = pws[gid].i[5];
203 pw_buf1[2] = pws[gid].i[6];
204 pw_buf1[3] = pws[gid].i[7];
206 const u32 pw_len = pws[gid].pw_len;
216 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
217 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
218 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
219 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
220 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
221 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
222 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
223 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
224 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
225 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
229 const u32 salt_len = salt_bufs[salt_pos].salt_len;
235 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
242 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
244 append_0x80_2x4_VV (w0, w1, out_len);
250 w0[0] = swap32 (w0[0]);
251 w0[1] = swap32 (w0[1]);
252 w0[2] = swap32 (w0[2]);
253 w0[3] = swap32 (w0[3]);
254 w1[0] = swap32 (w1[0]);
255 w1[1] = swap32 (w1[1]);
256 w1[2] = swap32 (w1[2]);
257 w1[3] = swap32 (w1[3]);
258 w2[0] = swap32 (w2[0]);
259 w2[1] = swap32 (w2[1]);
260 w2[2] = swap32 (w2[2]);
261 w2[3] = swap32 (w2[3]);
262 w3[0] = swap32 (w3[0]);
263 w3[1] = swap32 (w3[1]);
275 sha1_transform (w0, w1, w2, w3, digest);
289 w0[0] = salt_buf0[0];
290 w0[1] = salt_buf0[1];
291 w0[2] = salt_buf0[2];
292 w0[3] = salt_buf0[3];
293 w1[0] = salt_buf1[0];
294 w1[1] = salt_buf1[1];
295 w1[2] = salt_buf1[2];
296 w1[3] = salt_buf1[3];
297 w2[0] = salt_buf2[0];
298 w2[1] = salt_buf2[1];
299 w2[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
300 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
301 w2[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
302 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
303 w3[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
304 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
305 w3[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
306 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
307 w3[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
308 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
309 w3[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
310 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
318 sha1_transform (w0, w1, w2, w3, digest);
320 w0[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
321 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
322 w0[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
323 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
324 w0[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
325 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
326 w0[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
327 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
341 sha1_transform (w0, w1, w2, w3, digest);
349 w0[0] = salt_buf0[0];
350 w0[1] = salt_buf0[1];
351 w0[2] = salt_buf0[2];
352 w0[3] = salt_buf0[3];
353 w1[0] = salt_buf1[0];
354 w1[1] = salt_buf1[1];
355 w1[2] = salt_buf1[2];
356 w1[3] = salt_buf1[3];
357 w2[0] = salt_buf2[0];
358 w2[1] = salt_buf2[1];
359 w2[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
360 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
361 w2[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
362 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
363 w3[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
364 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
365 w3[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
366 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
367 w3[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
368 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
369 w3[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
370 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
378 sha1_transform (w0, w1, w2, w3, digest);
380 w0[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
381 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
382 w0[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
383 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
384 w0[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
385 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
386 w0[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
387 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
401 sha1_transform (w0, w1, w2, w3, digest);
403 COMPARE_M_SIMD (digest[3], digest[4], digest[2], digest[1]);
407 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
411 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
415 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
421 const u32 gid = get_global_id (0);
422 const u32 lid = get_local_id (0);
423 const u32 lsz = get_local_size (0);
429 __local u32 l_bin2asc[256];
431 for (u32 i = lid; i < 256; i += lsz)
433 const u32 i0 = (i >> 0) & 15;
434 const u32 i1 = (i >> 4) & 15;
436 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
437 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
440 barrier (CLK_LOCAL_MEM_FENCE);
442 if (gid >= gid_max) return;
451 pw_buf0[0] = pws[gid].i[0];
452 pw_buf0[1] = pws[gid].i[1];
453 pw_buf0[2] = pws[gid].i[2];
454 pw_buf0[3] = pws[gid].i[3];
455 pw_buf1[0] = pws[gid].i[4];
456 pw_buf1[1] = pws[gid].i[5];
457 pw_buf1[2] = pws[gid].i[6];
458 pw_buf1[3] = pws[gid].i[7];
460 const u32 pw_len = pws[gid].pw_len;
470 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
471 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
472 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
473 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
474 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
475 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
476 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
477 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
478 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
479 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
483 const u32 salt_len = salt_bufs[salt_pos].salt_len;
489 const u32 search[4] =
491 digests_buf[digests_offset].digest_buf[DGST_R0],
492 digests_buf[digests_offset].digest_buf[DGST_R1],
493 digests_buf[digests_offset].digest_buf[DGST_R2],
494 digests_buf[digests_offset].digest_buf[DGST_R3]
501 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
508 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
510 append_0x80_2x4_VV (w0, w1, out_len);
516 w0[0] = swap32 (w0[0]);
517 w0[1] = swap32 (w0[1]);
518 w0[2] = swap32 (w0[2]);
519 w0[3] = swap32 (w0[3]);
520 w1[0] = swap32 (w1[0]);
521 w1[1] = swap32 (w1[1]);
522 w1[2] = swap32 (w1[2]);
523 w1[3] = swap32 (w1[3]);
524 w2[0] = swap32 (w2[0]);
525 w2[1] = swap32 (w2[1]);
526 w2[2] = swap32 (w2[2]);
527 w2[3] = swap32 (w2[3]);
528 w3[0] = swap32 (w3[0]);
529 w3[1] = swap32 (w3[1]);
541 sha1_transform (w0, w1, w2, w3, digest);
555 w0[0] = salt_buf0[0];
556 w0[1] = salt_buf0[1];
557 w0[2] = salt_buf0[2];
558 w0[3] = salt_buf0[3];
559 w1[0] = salt_buf1[0];
560 w1[1] = salt_buf1[1];
561 w1[2] = salt_buf1[2];
562 w1[3] = salt_buf1[3];
563 w2[0] = salt_buf2[0];
564 w2[1] = salt_buf2[1];
565 w2[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
566 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
567 w2[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
568 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
569 w3[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
570 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
571 w3[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
572 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
573 w3[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
574 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
575 w3[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
576 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
584 sha1_transform (w0, w1, w2, w3, digest);
586 w0[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
587 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
588 w0[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
589 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
590 w0[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
591 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
592 w0[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
593 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
607 sha1_transform (w0, w1, w2, w3, digest);
615 w0[0] = salt_buf0[0];
616 w0[1] = salt_buf0[1];
617 w0[2] = salt_buf0[2];
618 w0[3] = salt_buf0[3];
619 w1[0] = salt_buf1[0];
620 w1[1] = salt_buf1[1];
621 w1[2] = salt_buf1[2];
622 w1[3] = salt_buf1[3];
623 w2[0] = salt_buf2[0];
624 w2[1] = salt_buf2[1];
625 w2[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
626 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
627 w2[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
628 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
629 w3[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
630 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
631 w3[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
632 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
633 w3[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
634 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
635 w3[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
636 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
644 sha1_transform (w0, w1, w2, w3, digest);
646 w0[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
647 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
648 w0[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
649 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
650 w0[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
651 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
652 w0[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
653 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
667 sha1_transform (w0, w1, w2, w3, digest);
669 COMPARE_S_SIMD (digest[3], digest[4], digest[2], digest[1]);
673 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
677 __kernel void m08400_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)