def FindPehash(results):
 for r in results:
  if (r['name'] == 'pecoff'):
   res = r
 if ('SignedData' not in res):
  print 'PE File, but no signature data present.'
  return
 for hashes in ('md5', 'sha1', 'sha256', 'sha512'):
  if (res['SignedData'][0][2].find(res[hashes]) != (-1)):
   print ('Found matching %s hash in SignedData.' % hashes)
   return
 print 'PE File with signature data, NO hash matches.'

def FindPehash ( results ) : for r in results : if ( r [ 'name' ] == 'pecoff' ) : res = r if ( 'SignedData' not in res ) : print 'PE File, but no signature data present.' return for hashes in ( 'md5' , 'sha1' , 'sha256' , 'sha512' ) : if ( res [ 'SignedData' ] [ 0 ] [ 2 ] . find ( res [ hashes ] ) != ( - 1 ) ) : print ( 'Found matching %s hash in SignedData.' % hashes ) return print 'PE File with signature data, NO hash matches.'
if file is pe/coff .