1 /**
2  * Author......: See docs/credits.txt
3  * License.....: MIT
4  */
5 
6 #include "common.h"
7 #include "types.h"
8 #include "modules.h"
9 #include "bitops.h"
10 #include "convert.h"
11 #include "shared.h"
12 
13 static const u32   ATTACK_EXEC    = ATTACK_EXEC_OUTSIDE_KERNEL;
14 static const u32   DGST_POS0      = 0;
15 static const u32   DGST_POS1      = 1;
16 static const u32   DGST_POS2      = 2;
17 static const u32   DGST_POS3      = 3;
18 static const u32   DGST_SIZE      = DGST_SIZE_8_16;
19 static const u32   HASH_CATEGORY  = HASH_CATEGORY_OS;
20 static const char *HASH_NAME      = "macOS v10.8+ (PBKDF2-SHA512)";
21 static const u64   KERN_TYPE      = 7100;
22 static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
23                                   | OPTI_TYPE_USES_BITS_64
24                                   | OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
25 static const u64   OPTS_TYPE      = OPTS_TYPE_PT_GENERATE_LE
26                                   | OPTS_TYPE_HASH_COPY;
27 static const u32   SALT_TYPE      = SALT_TYPE_EMBEDDED;
28 static const char *ST_PASS        = "hashcat";
29 static const char *ST_HASH        = "$ml$1024$2484380731132131624506271467162123576077004878124365203837706482$89a3a979ee186c0c837ca4551f32e951e6564c7ac6798aa35baf4427fbf6bd1d630642c12cfd5c236c7b0104782237db95e895f7c0e372cd81d58f0448daf958";
30 
module_attack_exec(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)31 u32         module_attack_exec    (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC;     }
module_dgst_pos0(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)32 u32         module_dgst_pos0      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0;       }
module_dgst_pos1(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)33 u32         module_dgst_pos1      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1;       }
module_dgst_pos2(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)34 u32         module_dgst_pos2      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2;       }
module_dgst_pos3(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)35 u32         module_dgst_pos3      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3;       }
module_dgst_size(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)36 u32         module_dgst_size      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE;       }
module_hash_category(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)37 u32         module_hash_category  (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY;   }
module_hash_name(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)38 const char *module_hash_name      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME;       }
module_kern_type(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)39 u64         module_kern_type      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE;       }
module_opti_type(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)40 u32         module_opti_type      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE;       }
module_opts_type(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)41 u64         module_opts_type      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE;       }
module_salt_type(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)42 u32         module_salt_type      (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE;       }
module_st_hash(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)43 const char *module_st_hash        (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH;         }
module_st_pass(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)44 const char *module_st_pass        (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS;         }
45 
46 typedef struct pbkdf2_sha512
47 {
48   u32 salt_buf[64];
49 
50 } pbkdf2_sha512_t;
51 
52 typedef struct pbkdf2_sha512_tmp
53 {
54   u64  ipad[8];
55   u64  opad[8];
56 
57   u64  dgst[16];
58   u64  out[16];
59 
60 } pbkdf2_sha512_tmp_t;
61 
62 static const char *SIGNATURE_SHA512MACOS = "$ml$";
63 
64 static const char *SIGNATURE_SHA512MACOS_JOHN = "$pbkdf2-hmac-sha512$";
65 
module_tmp_size(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)66 u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
67 {
68   const u64 tmp_size = (const u64) sizeof (pbkdf2_sha512_tmp_t);
69 
70   return tmp_size;
71 }
72 
module_esalt_size(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)73 u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
74 {
75   const u64 esalt_size = (const u64) sizeof (pbkdf2_sha512_t);
76 
77   return esalt_size;
78 }
79 
module_pw_max(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra)80 u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
81 {
82   const u32 pw_max = PW_MAX;
83 
84   return pw_max;
85 }
86 
module_jit_build_options(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const user_options_t * user_options,MAYBE_UNUSED const user_options_extra_t * user_options_extra,MAYBE_UNUSED const hashes_t * hashes,MAYBE_UNUSED const hc_device_param_t * device_param)87 char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
88 {
89   char *jit_build_options = NULL;
90 
91   hc_asprintf (&jit_build_options, "-D NO_UNROLL");
92 
93   return jit_build_options;
94 }
95 
module_hash_decode(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED void * digest_buf,MAYBE_UNUSED salt_t * salt,MAYBE_UNUSED void * esalt_buf,MAYBE_UNUSED void * hook_salt_buf,MAYBE_UNUSED hashinfo_t * hash_info,const char * line_buf,MAYBE_UNUSED const int line_len)96 int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
97 {
98   u64 *digest = (u64 *) digest_buf;
99 
100   pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) esalt_buf;
101 
102   char sigchk[21];
103   sigchk[20] = '\0';
104   memcpy (sigchk, line_buf, 20);
105 
106   if (strncmp (sigchk, SIGNATURE_SHA512MACOS, 4) == 0)
107   {
108     token_t token;
109 
110     token.token_cnt  = 4;
111 
112     token.signatures_cnt    = 1;
113     token.signatures_buf[0] = SIGNATURE_SHA512MACOS;
114 
115     token.len[0]     = 4;
116     token.attr[0]    = TOKEN_ATTR_FIXED_LENGTH
117                      | TOKEN_ATTR_VERIFY_SIGNATURE;
118 
119     token.len_min[1] = 1;
120     token.len_max[1] = 6;
121     token.sep[1]     = '$';
122     token.attr[1]    = TOKEN_ATTR_VERIFY_LENGTH
123                      | TOKEN_ATTR_VERIFY_DIGIT;
124 
125     token.len_min[2] = 64;
126     token.len_max[2] = 64;
127     token.sep[2]     = '$';
128     token.attr[2]    = TOKEN_ATTR_VERIFY_LENGTH
129                      | TOKEN_ATTR_VERIFY_HEX;
130 
131     token.len_min[3] = 128;
132     token.len_max[3] = 256;
133     token.attr[3]    = TOKEN_ATTR_VERIFY_LENGTH
134                      | TOKEN_ATTR_VERIFY_HEX;
135 
136     const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
137 
138     if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
139 
140     const int hash_len = token.len[3];
141 
142     if ((hash_len != 128) && (hash_len != 256)) return (PARSER_HASH_LENGTH);
143 
144     const u8 *hash_pos = token.buf[3];
145 
146     digest[0] = hex_to_u64 (hash_pos +   0);
147     digest[1] = hex_to_u64 (hash_pos +  16);
148     digest[2] = hex_to_u64 (hash_pos +  32);
149     digest[3] = hex_to_u64 (hash_pos +  48);
150     digest[4] = hex_to_u64 (hash_pos +  64);
151     digest[5] = hex_to_u64 (hash_pos +  80);
152     digest[6] = hex_to_u64 (hash_pos +  96);
153     digest[7] = hex_to_u64 (hash_pos + 112);
154 
155     digest[0] = byte_swap_64 (digest[0]);
156     digest[1] = byte_swap_64 (digest[1]);
157     digest[2] = byte_swap_64 (digest[2]);
158     digest[3] = byte_swap_64 (digest[3]);
159     digest[4] = byte_swap_64 (digest[4]);
160     digest[5] = byte_swap_64 (digest[5]);
161     digest[6] = byte_swap_64 (digest[6]);
162     digest[7] = byte_swap_64 (digest[7]);
163 
164     const u8 *salt_pos = token.buf[2];
165     const int salt_len = token.len[2] / 2;
166 
167     pbkdf2_sha512->salt_buf[0] = hex_to_u32 (salt_pos +  0);
168     pbkdf2_sha512->salt_buf[1] = hex_to_u32 (salt_pos +  8);
169     pbkdf2_sha512->salt_buf[2] = hex_to_u32 (salt_pos + 16);
170     pbkdf2_sha512->salt_buf[3] = hex_to_u32 (salt_pos + 24);
171     pbkdf2_sha512->salt_buf[4] = hex_to_u32 (salt_pos + 32);
172     pbkdf2_sha512->salt_buf[5] = hex_to_u32 (salt_pos + 40);
173     pbkdf2_sha512->salt_buf[6] = hex_to_u32 (salt_pos + 48);
174     pbkdf2_sha512->salt_buf[7] = hex_to_u32 (salt_pos + 56);
175 
176     salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0];
177     salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1];
178     salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2];
179     salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3];
180     salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4];
181     salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5];
182     salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6];
183     salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7];
184     salt->salt_len    = salt_len;
185 
186     const u8 *iter_pos = token.buf[1];
187 
188     salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1;
189 
190     return (PARSER_OK);
191   }
192 
193   if (strncmp (sigchk, SIGNATURE_SHA512MACOS_JOHN, 20) == 0)
194   {
195     token_t token;
196 
197     token.token_cnt  = 7;
198 
199     token.signatures_cnt    = 1;
200     token.signatures_buf[0] = SIGNATURE_SHA512MACOS_JOHN;
201 
202     token.len[0]     = 20;
203     token.attr[0]    = TOKEN_ATTR_FIXED_LENGTH
204                      | TOKEN_ATTR_VERIFY_SIGNATURE;
205 
206     token.len_min[1] = 1;
207     token.len_max[1] = 6;
208     token.sep[1]     = '.';
209     token.attr[1]    = TOKEN_ATTR_VERIFY_LENGTH
210                      | TOKEN_ATTR_VERIFY_DIGIT;
211 
212     token.len_min[2] = 64;
213     token.len_max[2] = 64;
214     token.sep[2]     = '.';
215     token.attr[2]    = TOKEN_ATTR_VERIFY_LENGTH
216                      | TOKEN_ATTR_VERIFY_HEX;
217 
218     token.len_min[3] = 128;
219     token.len_max[3] = 256;
220     token.sep[3]     = ':';
221     token.attr[3]    = TOKEN_ATTR_VERIFY_LENGTH
222                      | TOKEN_ATTR_VERIFY_HEX;
223 
224     token.len_min[4] = 0;
225     token.len_max[4] = 16;
226     token.sep[4]     = ':';
227     token.attr[4]    = TOKEN_ATTR_VERIFY_LENGTH;
228 
229     token.len_min[5] = 0;
230     token.len_max[5] = 16;
231     token.sep[5]     = ':';
232     token.attr[5]    = TOKEN_ATTR_VERIFY_LENGTH;
233 
234     token.len_min[6] = 0;
235     token.len_max[6] = 32;
236     token.attr[6]    = TOKEN_ATTR_VERIFY_LENGTH;
237 
238     const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
239 
240     if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
241 
242     const int hash_len = token.len[3];
243 
244     if ((hash_len != 128) && (hash_len != 256)) return (PARSER_HASH_LENGTH);
245 
246     const u8 *hash_pos = token.buf[3];
247 
248     digest[0] = hex_to_u64 (hash_pos +   0);
249     digest[1] = hex_to_u64 (hash_pos +  16);
250     digest[2] = hex_to_u64 (hash_pos +  32);
251     digest[3] = hex_to_u64 (hash_pos +  48);
252     digest[4] = hex_to_u64 (hash_pos +  64);
253     digest[5] = hex_to_u64 (hash_pos +  80);
254     digest[6] = hex_to_u64 (hash_pos +  96);
255     digest[7] = hex_to_u64 (hash_pos + 112);
256 
257     digest[0] = byte_swap_64 (digest[0]);
258     digest[1] = byte_swap_64 (digest[1]);
259     digest[2] = byte_swap_64 (digest[2]);
260     digest[3] = byte_swap_64 (digest[3]);
261     digest[4] = byte_swap_64 (digest[4]);
262     digest[5] = byte_swap_64 (digest[5]);
263     digest[6] = byte_swap_64 (digest[6]);
264     digest[7] = byte_swap_64 (digest[7]);
265 
266     const u8 *salt_pos = token.buf[2];
267     const int salt_len = token.len[2] / 2;
268 
269     pbkdf2_sha512->salt_buf[0] = hex_to_u32 (salt_pos +  0);
270     pbkdf2_sha512->salt_buf[1] = hex_to_u32 (salt_pos +  8);
271     pbkdf2_sha512->salt_buf[2] = hex_to_u32 (salt_pos + 16);
272     pbkdf2_sha512->salt_buf[3] = hex_to_u32 (salt_pos + 24);
273     pbkdf2_sha512->salt_buf[4] = hex_to_u32 (salt_pos + 32);
274     pbkdf2_sha512->salt_buf[5] = hex_to_u32 (salt_pos + 40);
275     pbkdf2_sha512->salt_buf[6] = hex_to_u32 (salt_pos + 48);
276     pbkdf2_sha512->salt_buf[7] = hex_to_u32 (salt_pos + 56);
277 
278     salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0];
279     salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1];
280     salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2];
281     salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3];
282     salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4];
283     salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5];
284     salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6];
285     salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7];
286     salt->salt_len    = salt_len;
287 
288     const u8 *iter_pos = token.buf[1];
289 
290     salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1;
291 
292     return (PARSER_OK);
293   }
294   return (PARSER_SIGNATURE_UNMATCHED);
295 }
296 
297 /* replaced with OPTS_TYPE_HASH_COPY version
298 
299 int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
300 {
301   const u32 *digest = (const u32 *) digest_buf;
302 
303   const pbkdf2_sha512_t *pbkdf2_sha512 = (const pbkdf2_sha512_t *) esalt_buf;
304 
305   // we can not change anything in the original buffer, otherwise destroying sorting
306   // therefore create some local buffer
307 
308   u32 esalt[8] = { 0 };
309 
310   esalt[0] = byte_swap_32 (pbkdf2_sha512->salt_buf[0]);
311   esalt[1] = byte_swap_32 (pbkdf2_sha512->salt_buf[1]);
312   esalt[2] = byte_swap_32 (pbkdf2_sha512->salt_buf[2]);
313   esalt[3] = byte_swap_32 (pbkdf2_sha512->salt_buf[3]);
314   esalt[4] = byte_swap_32 (pbkdf2_sha512->salt_buf[4]);
315   esalt[5] = byte_swap_32 (pbkdf2_sha512->salt_buf[5]);
316   esalt[6] = byte_swap_32 (pbkdf2_sha512->salt_buf[6]);
317   esalt[7] = byte_swap_32 (pbkdf2_sha512->salt_buf[7]);
318 
319   const int line_len = snprintf (line_buf, line_size, "%s%u$%08x%08x%08x%08x%08x%08x%08x%08x$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
320     SIGNATURE_SHA512MACOS,
321     salt->salt_iter + 1,
322     esalt[ 0], esalt[ 1],
323     esalt[ 2], esalt[ 3],
324     esalt[ 4], esalt[ 5],
325     esalt[ 6], esalt[ 7],
326     digest[ 1], digest[ 0],
327     digest[ 3], digest[ 2],
328     digest[ 5], digest[ 4],
329     digest[ 7], digest[ 6],
330     digest[ 9], digest[ 8],
331     digest[11], digest[10],
332     digest[13], digest[12],
333     digest[15], digest[14]);
334 
335   return line_len;
336 }
337 */
338 
module_hash_encode(MAYBE_UNUSED const hashconfig_t * hashconfig,MAYBE_UNUSED const void * digest_buf,MAYBE_UNUSED const salt_t * salt,MAYBE_UNUSED const void * esalt_buf,MAYBE_UNUSED const void * hook_salt_buf,MAYBE_UNUSED const hashinfo_t * hash_info,char * line_buf,MAYBE_UNUSED const int line_size)339 int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
340 {
341   const int line_len = snprintf (line_buf, line_size, "%s", hash_info->orighash);
342 
343   return line_len;
344 }
345 
module_init(module_ctx_t * module_ctx)346 void module_init (module_ctx_t *module_ctx)
347 {
348   module_ctx->module_context_size             = MODULE_CONTEXT_SIZE_CURRENT;
349   module_ctx->module_interface_version        = MODULE_INTERFACE_VERSION_CURRENT;
350 
351   module_ctx->module_attack_exec              = module_attack_exec;
352   module_ctx->module_benchmark_esalt          = MODULE_DEFAULT;
353   module_ctx->module_benchmark_hook_salt      = MODULE_DEFAULT;
354   module_ctx->module_benchmark_mask           = MODULE_DEFAULT;
355   module_ctx->module_benchmark_salt           = MODULE_DEFAULT;
356   module_ctx->module_build_plain_postprocess  = MODULE_DEFAULT;
357   module_ctx->module_deep_comp_kernel         = MODULE_DEFAULT;
358   module_ctx->module_deprecated_notice        = MODULE_DEFAULT;
359   module_ctx->module_dgst_pos0                = module_dgst_pos0;
360   module_ctx->module_dgst_pos1                = module_dgst_pos1;
361   module_ctx->module_dgst_pos2                = module_dgst_pos2;
362   module_ctx->module_dgst_pos3                = module_dgst_pos3;
363   module_ctx->module_dgst_size                = module_dgst_size;
364   module_ctx->module_dictstat_disable         = MODULE_DEFAULT;
365   module_ctx->module_esalt_size               = module_esalt_size;
366   module_ctx->module_extra_buffer_size        = MODULE_DEFAULT;
367   module_ctx->module_extra_tmp_size           = MODULE_DEFAULT;
368   module_ctx->module_extra_tuningdb_block     = MODULE_DEFAULT;
369   module_ctx->module_forced_outfile_format    = MODULE_DEFAULT;
370   module_ctx->module_hash_binary_count        = MODULE_DEFAULT;
371   module_ctx->module_hash_binary_parse        = MODULE_DEFAULT;
372   module_ctx->module_hash_binary_save         = MODULE_DEFAULT;
373   module_ctx->module_hash_decode_potfile      = MODULE_DEFAULT;
374   module_ctx->module_hash_decode_zero_hash    = MODULE_DEFAULT;
375   module_ctx->module_hash_decode              = module_hash_decode;
376   module_ctx->module_hash_encode_status       = MODULE_DEFAULT;
377   module_ctx->module_hash_encode_potfile      = MODULE_DEFAULT;
378   module_ctx->module_hash_encode              = module_hash_encode;
379   module_ctx->module_hash_init_selftest       = MODULE_DEFAULT;
380   module_ctx->module_hash_mode                = MODULE_DEFAULT;
381   module_ctx->module_hash_category            = module_hash_category;
382   module_ctx->module_hash_name                = module_hash_name;
383   module_ctx->module_hashes_count_min         = MODULE_DEFAULT;
384   module_ctx->module_hashes_count_max         = MODULE_DEFAULT;
385   module_ctx->module_hlfmt_disable            = MODULE_DEFAULT;
386   module_ctx->module_hook_extra_param_size    = MODULE_DEFAULT;
387   module_ctx->module_hook_extra_param_init    = MODULE_DEFAULT;
388   module_ctx->module_hook_extra_param_term    = MODULE_DEFAULT;
389   module_ctx->module_hook12                   = MODULE_DEFAULT;
390   module_ctx->module_hook23                   = MODULE_DEFAULT;
391   module_ctx->module_hook_salt_size           = MODULE_DEFAULT;
392   module_ctx->module_hook_size                = MODULE_DEFAULT;
393   module_ctx->module_jit_build_options        = module_jit_build_options;
394   module_ctx->module_jit_cache_disable        = MODULE_DEFAULT;
395   module_ctx->module_kernel_accel_max         = MODULE_DEFAULT;
396   module_ctx->module_kernel_accel_min         = MODULE_DEFAULT;
397   module_ctx->module_kernel_loops_max         = MODULE_DEFAULT;
398   module_ctx->module_kernel_loops_min         = MODULE_DEFAULT;
399   module_ctx->module_kernel_threads_max       = MODULE_DEFAULT;
400   module_ctx->module_kernel_threads_min       = MODULE_DEFAULT;
401   module_ctx->module_kern_type                = module_kern_type;
402   module_ctx->module_kern_type_dynamic        = MODULE_DEFAULT;
403   module_ctx->module_opti_type                = module_opti_type;
404   module_ctx->module_opts_type                = module_opts_type;
405   module_ctx->module_outfile_check_disable    = MODULE_DEFAULT;
406   module_ctx->module_outfile_check_nocomp     = MODULE_DEFAULT;
407   module_ctx->module_potfile_custom_check     = MODULE_DEFAULT;
408   module_ctx->module_potfile_disable          = MODULE_DEFAULT;
409   module_ctx->module_potfile_keep_all_hashes  = MODULE_DEFAULT;
410   module_ctx->module_pwdump_column            = MODULE_DEFAULT;
411   module_ctx->module_pw_max                   = module_pw_max;
412   module_ctx->module_pw_min                   = MODULE_DEFAULT;
413   module_ctx->module_salt_max                 = MODULE_DEFAULT;
414   module_ctx->module_salt_min                 = MODULE_DEFAULT;
415   module_ctx->module_salt_type                = module_salt_type;
416   module_ctx->module_separator                = MODULE_DEFAULT;
417   module_ctx->module_st_hash                  = module_st_hash;
418   module_ctx->module_st_pass                  = module_st_pass;
419   module_ctx->module_tmp_size                 = module_tmp_size;
420   module_ctx->module_unstable_warning         = MODULE_DEFAULT;
421   module_ctx->module_warmup_disable           = MODULE_DEFAULT;
422 }
423