#NEWLINE# def calculate_merkle_pairs( bin_hashes , hash_function = bin_double_sha256 ) : #NEWLINE# #INDENT# ' takes in a list of binary hashes, returns a binary hash\n    ' #NEWLINE# hashes = list ( bin_hashes ) #NEWLINE# if ( ( len ( hashes ) % 2 ) == 1 ) : #NEWLINE# #INDENT# hashes . append ( hashes [ ( - 1 ) ] ) #NEWLINE# #UNINDENT# new_hashes = [ ] #NEWLINE# for i in range ( 0 , len ( hash_function ) , 2 ) : #NEWLINE# #INDENT# new_hashes . append ( hash_function ( ( hashes [ i ] + hashes [ ( i + 1 ) ] ) ) ) #NEWLINE# #UNINDENT# return new_hashes