#NEWLINE# def generate_hashes( peaks , fan_value = DEFAULT_FAN_VALUE ) : #NEWLINE# #INDENT# '\n    Hash list structure:\n       sha1_hash[0:20]    time_offset\n    [(e05b341a9b77a51fd26, 32), ... ]\n    ' #NEWLINE# if PEAK_SORT : #NEWLINE# #INDENT# peaks . sort ( key = itemgetter ( 1 ) ) #NEWLINE# #UNINDENT# for i in range ( len ( peaks ) ) : #NEWLINE# #INDENT# for j in range ( 1 , fan_value ) : #NEWLINE# #INDENT# if ( ( i + j ) < len ( i ) ) : #NEWLINE# #INDENT# freq1 = peaks [ i ] [ IDX_FREQ_I ] #NEWLINE# freq2 = peaks [ ( i + j ) ] [ IDX_FREQ_I ] #NEWLINE# t1 = peaks [ i ] [ IDX_TIME_J ] #NEWLINE# t2 = peaks [ ( i + j ) ] [ IDX_TIME_J ] #NEWLINE# t_delta = ( t2 - t1 ) #NEWLINE# if ( ( t_delta >= MIN_HASH_TIME_DELTA ) and ( t_delta <= MAX_HASH_TIME_DELTA ) ) : #NEWLINE# #INDENT# h = hashlib . sha1 ( ( '%s|%s|%s' % ( str ( freq1 ) , str ( freq2 ) , str ( t_delta ) ) ) ) #NEWLINE# ( yield ( h . hexdigest ( ) [ 0 : FINGERPRINT_REDUCTION ] , t1 ) )