1/**
2 * Author......: See docs/credits.txt
3 * License.....: MIT
4 */
5
6#define NEW_SIMD_CODE
7
8#ifdef KERNEL_STATIC
9#include "inc_vendor.h"
10#include "inc_types.h"
11#include "inc_platform.cl"
12#include "inc_common.cl"
13#include "inc_simd.cl"
14#include "inc_hash_ripemd160.cl"
15#endif
16
17DECLSPEC void ripemd160_transform_transport_vector (const u32x *w, u32x *dgst)
18{
19  ripemd160_transform_vector (w + 0, w + 4, w + 8, w + 12, dgst);
20}
21
22DECLSPEC void m06000m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
23{
24  /**
25   * modifier
26   */
27
28  const u64 gid = get_global_id (0);
29  const u64 lid = get_local_id (0);
30
31  /**
32   * loop
33   */
34
35  u32 w0l = w0[0];
36
37  for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
38  {
39    const u32x w0r = ix_create_bft (bfs_buf, il_pos);
40
41    const u32x w0lr = w0l | w0r;
42
43    u32x w[16];
44
45    w[ 0] = w0lr;
46    w[ 1] = w0[1];
47    w[ 2] = w0[2];
48    w[ 3] = w0[3];
49    w[ 4] = w1[0];
50    w[ 5] = w1[1];
51    w[ 6] = w1[2];
52    w[ 7] = w1[3];
53    w[ 8] = w2[0];
54    w[ 9] = w2[1];
55    w[10] = w2[2];
56    w[11] = w2[3];
57    w[12] = w3[0];
58    w[13] = w3[1];
59    w[14] = pw_len * 8;
60    w[15] = 0;
61
62    /**
63     * RipeMD160
64     */
65
66    u32x dgst[5];
67
68    dgst[0] = RIPEMD160M_A;
69    dgst[1] = RIPEMD160M_B;
70    dgst[2] = RIPEMD160M_C;
71    dgst[3] = RIPEMD160M_D;
72    dgst[4] = RIPEMD160M_E;
73
74    ripemd160_transform_transport_vector (w, dgst);
75
76    COMPARE_M_SIMD (dgst[0], dgst[1], dgst[2], dgst[3]);
77  }
78}
79
80DECLSPEC void m06000s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
81{
82  /**
83   * modifier
84   */
85
86  const u64 gid = get_global_id (0);
87  const u64 lid = get_local_id (0);
88
89  /**
90   * digest
91   */
92
93  const u32 search[4] =
94  {
95    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
96    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
97    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
98    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
99  };
100
101  /**
102   * loop
103   */
104
105  u32 w0l = w0[0];
106
107  for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
108  {
109    const u32x w0r = ix_create_bft (bfs_buf, il_pos);
110
111    const u32x w0lr = w0l | w0r;
112
113    u32x w[16];
114
115    w[ 0] = w0lr;
116    w[ 1] = w0[1];
117    w[ 2] = w0[2];
118    w[ 3] = w0[3];
119    w[ 4] = w1[0];
120    w[ 5] = w1[1];
121    w[ 6] = w1[2];
122    w[ 7] = w1[3];
123    w[ 8] = w2[0];
124    w[ 9] = w2[1];
125    w[10] = w2[2];
126    w[11] = w2[3];
127    w[12] = w3[0];
128    w[13] = w3[1];
129    w[14] = pw_len * 8;
130    w[15] = 0;
131
132    /**
133     * RipeMD160
134     */
135
136    u32x dgst[5];
137
138    dgst[0] = RIPEMD160M_A;
139    dgst[1] = RIPEMD160M_B;
140    dgst[2] = RIPEMD160M_C;
141    dgst[3] = RIPEMD160M_D;
142    dgst[4] = RIPEMD160M_E;
143
144    ripemd160_transform_transport_vector (w, dgst);
145
146    COMPARE_S_SIMD (dgst[0], dgst[1], dgst[2], dgst[3]);
147  }
148}
149
150KERNEL_FQ void m06000_m04 (KERN_ATTR_BASIC ())
151{
152  /**
153   * base
154   */
155
156  const u64 gid = get_global_id (0);
157
158  if (gid >= gid_max) return;
159
160  u32 w0[4];
161
162  w0[0] = pws[gid].i[ 0];
163  w0[1] = pws[gid].i[ 1];
164  w0[2] = pws[gid].i[ 2];
165  w0[3] = pws[gid].i[ 3];
166
167  u32 w1[4];
168
169  w1[0] = 0;
170  w1[1] = 0;
171  w1[2] = 0;
172  w1[3] = 0;
173
174  u32 w2[4];
175
176  w2[0] = 0;
177  w2[1] = 0;
178  w2[2] = 0;
179  w2[3] = 0;
180
181  u32 w3[4];
182
183  w3[0] = 0;
184  w3[1] = 0;
185  w3[2] = 0;
186  w3[3] = 0;
187
188  const u32 pw_len = pws[gid].pw_len & 63;
189
190  /**
191   * main
192   */
193
194  m06000m (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
195}
196
197KERNEL_FQ void m06000_m08 (KERN_ATTR_BASIC ())
198{
199  /**
200   * base
201   */
202
203  const u64 gid = get_global_id (0);
204
205  if (gid >= gid_max) return;
206
207  u32 w0[4];
208
209  w0[0] = pws[gid].i[ 0];
210  w0[1] = pws[gid].i[ 1];
211  w0[2] = pws[gid].i[ 2];
212  w0[3] = pws[gid].i[ 3];
213
214  u32 w1[4];
215
216  w1[0] = pws[gid].i[ 4];
217  w1[1] = pws[gid].i[ 5];
218  w1[2] = pws[gid].i[ 6];
219  w1[3] = pws[gid].i[ 7];
220
221  u32 w2[4];
222
223  w2[0] = 0;
224  w2[1] = 0;
225  w2[2] = 0;
226  w2[3] = 0;
227
228  u32 w3[4];
229
230  w3[0] = 0;
231  w3[1] = 0;
232  w3[2] = 0;
233  w3[3] = 0;
234
235  const u32 pw_len = pws[gid].pw_len & 63;
236
237  /**
238   * main
239   */
240
241  m06000m (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
242}
243
244KERNEL_FQ void m06000_m16 (KERN_ATTR_BASIC ())
245{
246  /**
247   * base
248   */
249
250  const u64 gid = get_global_id (0);
251
252  if (gid >= gid_max) return;
253
254  u32 w0[4];
255
256  w0[0] = pws[gid].i[ 0];
257  w0[1] = pws[gid].i[ 1];
258  w0[2] = pws[gid].i[ 2];
259  w0[3] = pws[gid].i[ 3];
260
261  u32 w1[4];
262
263  w1[0] = pws[gid].i[ 4];
264  w1[1] = pws[gid].i[ 5];
265  w1[2] = pws[gid].i[ 6];
266  w1[3] = pws[gid].i[ 7];
267
268  u32 w2[4];
269
270  w2[0] = pws[gid].i[ 8];
271  w2[1] = pws[gid].i[ 9];
272  w2[2] = pws[gid].i[10];
273  w2[3] = pws[gid].i[11];
274
275  u32 w3[4];
276
277  w3[0] = pws[gid].i[12];
278  w3[1] = pws[gid].i[13];
279  w3[2] = 0;
280  w3[3] = 0;
281
282  const u32 pw_len = pws[gid].pw_len & 63;
283
284  /**
285   * main
286   */
287
288  m06000m (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
289}
290
291KERNEL_FQ void m06000_s04 (KERN_ATTR_BASIC ())
292{
293  /**
294   * base
295   */
296
297  const u64 gid = get_global_id (0);
298
299  if (gid >= gid_max) return;
300
301  u32 w0[4];
302
303  w0[0] = pws[gid].i[ 0];
304  w0[1] = pws[gid].i[ 1];
305  w0[2] = pws[gid].i[ 2];
306  w0[3] = pws[gid].i[ 3];
307
308  u32 w1[4];
309
310  w1[0] = 0;
311  w1[1] = 0;
312  w1[2] = 0;
313  w1[3] = 0;
314
315  u32 w2[4];
316
317  w2[0] = 0;
318  w2[1] = 0;
319  w2[2] = 0;
320  w2[3] = 0;
321
322  u32 w3[4];
323
324  w3[0] = 0;
325  w3[1] = 0;
326  w3[2] = 0;
327  w3[3] = 0;
328
329  const u32 pw_len = pws[gid].pw_len & 63;
330
331  /**
332   * main
333   */
334
335  m06000s (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
336}
337
338KERNEL_FQ void m06000_s08 (KERN_ATTR_BASIC ())
339{
340  /**
341   * base
342   */
343
344  const u64 gid = get_global_id (0);
345
346  if (gid >= gid_max) return;
347
348  u32 w0[4];
349
350  w0[0] = pws[gid].i[ 0];
351  w0[1] = pws[gid].i[ 1];
352  w0[2] = pws[gid].i[ 2];
353  w0[3] = pws[gid].i[ 3];
354
355  u32 w1[4];
356
357  w1[0] = pws[gid].i[ 4];
358  w1[1] = pws[gid].i[ 5];
359  w1[2] = pws[gid].i[ 6];
360  w1[3] = pws[gid].i[ 7];
361
362  u32 w2[4];
363
364  w2[0] = 0;
365  w2[1] = 0;
366  w2[2] = 0;
367  w2[3] = 0;
368
369  u32 w3[4];
370
371  w3[0] = 0;
372  w3[1] = 0;
373  w3[2] = 0;
374  w3[3] = 0;
375
376  const u32 pw_len = pws[gid].pw_len & 63;
377
378  /**
379   * main
380   */
381
382  m06000s (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
383}
384
385KERNEL_FQ void m06000_s16 (KERN_ATTR_BASIC ())
386{
387  /**
388   * base
389   */
390
391  const u64 gid = get_global_id (0);
392
393  if (gid >= gid_max) return;
394
395  u32 w0[4];
396
397  w0[0] = pws[gid].i[ 0];
398  w0[1] = pws[gid].i[ 1];
399  w0[2] = pws[gid].i[ 2];
400  w0[3] = pws[gid].i[ 3];
401
402  u32 w1[4];
403
404  w1[0] = pws[gid].i[ 4];
405  w1[1] = pws[gid].i[ 5];
406  w1[2] = pws[gid].i[ 6];
407  w1[3] = pws[gid].i[ 7];
408
409  u32 w2[4];
410
411  w2[0] = pws[gid].i[ 8];
412  w2[1] = pws[gid].i[ 9];
413  w2[2] = pws[gid].i[10];
414  w2[3] = pws[gid].i[11];
415
416  u32 w3[4];
417
418  w3[0] = pws[gid].i[12];
419  w3[1] = pws[gid].i[13];
420  w3[2] = 0;
421  w3[3] = 0;
422
423  const u32 pw_len = pws[gid].pw_len & 63;
424
425  /**
426   * main
427   */
428
429  m06000s (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_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, salt_repeat, pws_pos, gid_max);
430}
431