{ "7a73673e78669ea238ca550814dca7000d7026cc", "!!!!1111eleven" }, // repeat last hash in exactly the same format that is used for john.pot {"$dynamic_26$7a73673e78669ea238ca550814dca7000d7026cc", "!!!!1111eleven"}, ''' vs = { 'fmt_struct_name': 'raw1_sha1', 'format_name': 'Raw-SHA1', 'algo_name': 'SHA1', 'tag': '$dynamic_26$', 'plaintext_length': '55', 'binary_form_size': '20', 'tests': tests } U.setup_vars(vs) # Optimizations and code generation interleave = 2 B.global_vars['batch_size'] = 10 reverse_num = 4 B.global_vars['interleave'] = interleave B.global_vars['reverse_num'] = reverse_num B.global_vars['vectorize'] = 1
tests = r''' {"6d3ad29d279110eef3adbd66de2a0345a77baede1557f5d099fce0c03d6dc2ba8e6d4a6633dfbd66053c20faa87d1a11f39a7fbe4a6c2f009801370308fc4ad8", ""}, {"70e1c68c60df3b655339d67dc291cc3f1dde4ef343f11b23fdd44957693815a75a8339c682fc28322513fd1f283c18e53cff2b264e06bf83a2f0ac8c1f6fbff6", "abc"}, ''' vs = { 'fmt_struct_name': 'raw1_groestl512', 'format_name': 'Raw-groestl512', 'algo_name': 'GROESTL512', 'tag': '$groestl512$', 'plaintext_length': '111', 'binary_form_size': '64', 'tests': tests } U.setup_vars(vs) # Optimizations and code generation interleave = 1 # B.global_vars['batch_size'] = 20 # B.global_vars['batch_size'] = 16 B.global_vars['batch_size'] = 1 reverse_num = 0 B.global_vars['interleave'] = interleave B.global_vars['reverse_num'] = reverse_num B.global_vars['vectorize'] = 0
def gen_raw_format(c_template, algo_file, tests, tag=None, special1=None, special2=None, special0=None, reverse_num=0, algo_override=None): c_code = U.load_code_template(c_template) args = {} # # %% extract that from code # size = 4 # endianity = 'be' algo_name = algo_file algo_upper = algo_name.upper() algo_code = B.get_code_full(algo_override or algo_file, **args) d = algo_code if special0: d = B.thread_code(d, *special0) interface = B.get_interface(d) size = interface['size'] endianity = interface['endianity'] inputs = interface['inputs'] outputs = interface['outputs'] print interface if not tag: tag = '$' + algo_upper + '$' vs = { 'fmt_struct_name': 'raw1_' + algo_name, 'format_name': fmt_name_raw(algo_name), 'algo_name': 'dk ' + algo_upper, 'tag': tag, 'plaintext_length': (inputs - 2) * size - 1, 'binary_form_size': outputs * size, 'tests': tests } O.apply_bs_size(bs_size) U.setup_vars(vs) # Optimizations and code generation interleave = 1 B.global_vars['batch_size'] = 1 # reverse_num = 7 B.global_vars['interleave'] = interleave B.global_vars['reverse_num'] = reverse_num B.global_vars['vectorize'] = 1 d = B.thread_code(d, B.replace_state_with_const) if special1: d = B.thread_code(d, *special1) d = B.thread_code( d, B.remove_assignments, [B.compute_const_expressions, size], [B.no_reverse, reverse_num], ) reverse = d['reverse'] code = d['code'] scalar = B.deep_copy(code) reverse_str = B.thread_code(reverse, [B.dump, 'reverse.bytecode'], [O.gen_to_str, '$code', args]) B.global_vars['reverse'] = reverse_str scalar_str = B.thread_code(scalar, [B.dump, 'scalar.bytecode'], [O.gen_to_str, '$code', args]) B.global_vars['scalar'] = scalar_str out_file = fmt_file(vs['format_name']) d = B.thread_code(code, B.vectorize) if special2: d = B.thread_code(d, *special2) d = B.thread_code(d, B.use_define_for_some, [B.interleave, interleave], [O.gen, out_file, c_code, args, B.global_vars])