1 /* 2 * This software is Copyright (c) 2016 Denis Burykin 3 * [denis_burykin yahoo com], [denis-burykin2014 yandex ru] 4 * and it is hereby released to the general public under the following terms: 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted. 7 * 8 */ 9 #ifndef _JTR_MASK_H_ 10 #define _JTR_MASK_H_ 11 12 #include "../mask_ext.h" 13 14 /* 15 * Functions to access mask data. 16 */ 17 mask_is_inactive()18inline static int mask_is_inactive() 19 { 20 return mask_int_cand.num_int_cand == 1; 21 } 22 mask_num_cand()23inline static unsigned int mask_num_cand() 24 { 25 return mask_int_cand.num_int_cand; 26 } 27 28 // Displays mask data in human-readable form (for debugging) 29 void mask_print(); 30 31 // Gets mask data for current template key. Converts into 'range_info' data 32 // for remote devices and stores in the location pointed to by 'range_info'. 33 // Designed for use in set_key(). 34 void mask_set_range_info(unsigned char *range_info); 35 36 // Gets mask data. Converts into the configuration 37 // for word generators on remote devices. 38 // If mask is not used, creates generator configuration that 39 // would pass-by plaintext candidates. 40 // Returns pointer to 'static struct word_gen'. 41 struct word_gen *mask_convert_to_word_gen(); 42 43 // Reconstructs plaintext out of template key, range_info and 44 // ID of generated candidate. 'key' is modified in place. 45 void mask_reconstruct_plaintext( 46 char *key, 47 unsigned char *range_info, 48 unsigned int gen_id); 49 50 #endif 51