def write_binary_file_from_hex0_file(input_file, output_file): # character based file read, but not UTF-8 input_file_fd = open_ascii(input_file) output_file_fd = open(output_file, 'wb') # binary output write_binary_filefd_from_hex0_filefd(input_file_fd, output_file_fd) output_file_fd.close() input_file_fd.close()
def M1_files_to_bin(input_filenames, output_filename, close_after=COMPAT_TRUE): input_file_objs = [ open_ascii(filename) for filename in input_filenames ] output_file_obj = open(output_filename, 'wb') M1_files_objs_to_bin(input_file_objs, output_file_obj) if close_after: output_file_obj.close() for f in input_file_objs: f.close()
def get_sha256sum_of_file_after_files_are_M1_assembled_and_hex2_linked( *filenames): with BytesIO() as outputmemfile: input_fileobjs = [ open_ascii(filename) for filename in filenames ] M1_files_objs_to_bin(input_fileobjs, outputmemfile ) for f in input_fileobjs: f.close() hexdigest = sha256(outputmemfile.getbuffer()).hexdigest() return hexdigest
def write_binary_file_from_hex1_file(input_filename, output_filename): input_file = open_ascii(input_filename) output_file = open(output_filename, 'wb') # binary output write_binary_filefd_from_hex1_filefd(input_file, output_file) output_file.close() input_file.close()