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_rp.h"
14#include "inc_rp.cl"
15#include "inc_scalar.cl"
16#include "inc_hash_md5.cl"
17#endif
18
19KERNEL_FQ void m09900_mxx (KERN_ATTR_RULES ())
20{
21  /**
22   * modifier
23   */
24
25  const u64 lid = get_local_id (0);
26  const u64 gid = get_global_id (0);
27
28  if (gid >= gid_max) return;
29
30  /**
31   * base
32   */
33
34  COPY_PW (pws[gid]);
35
36  /**
37   * loop
38   */
39
40  for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
41  {
42    pw_t tmp = PASTE_PW;
43
44    tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
45
46    md5_ctx_t ctx;
47
48    md5_init (&ctx);
49
50    md5_update (&ctx, tmp.i, 100);
51
52    md5_final (&ctx);
53
54    const u32 r0 = ctx.h[DGST_R0];
55    const u32 r1 = ctx.h[DGST_R1];
56    const u32 r2 = ctx.h[DGST_R2];
57    const u32 r3 = ctx.h[DGST_R3];
58
59    COMPARE_M_SCALAR (r0, r1, r2, r3);
60  }
61}
62
63KERNEL_FQ void m09900_sxx (KERN_ATTR_RULES ())
64{
65  /**
66   * modifier
67   */
68
69  const u64 lid = get_local_id (0);
70  const u64 gid = get_global_id (0);
71
72  if (gid >= gid_max) return;
73
74  /**
75   * digest
76   */
77
78  const u32 search[4] =
79  {
80    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
81    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
82    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
83    digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
84  };
85
86  /**
87   * base
88   */
89
90  COPY_PW (pws[gid]);
91
92  /**
93   * loop
94   */
95
96  for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
97  {
98    pw_t tmp = PASTE_PW;
99
100    tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
101
102    md5_ctx_t ctx;
103
104    md5_init (&ctx);
105
106    md5_update (&ctx, tmp.i, 100);
107
108    md5_final (&ctx);
109
110    const u32 r0 = ctx.h[DGST_R0];
111    const u32 r1 = ctx.h[DGST_R1];
112    const u32 r2 = ctx.h[DGST_R2];
113    const u32 r3 = ctx.h[DGST_R3];
114
115    COMPARE_S_SCALAR (r0, r1, r2, r3);
116  }
117}
118