#! /usr/bin/python
import hashlib
import re
#readpe -HdS <file> >> out
def iatHeaderHash(file):
	hashArr = {iter: 0 for iter in range(0x100)}
	sha = hashlib.sha256()
	num = []
	fin = open(file, 'rb')
	
	for line in fin:
		nH = re.findall(r'0x[0-9a-fA-F]+', line, re.I)	
		if len(nH) > 0:
			for i in range(0,1):
				num.append(nH[i])
		else:
			n = re.findall(r'[0-9]+', line, re.I)	
			if len(n) > 0:
				for i in range(0,1):
					num.append(n[i])
	for str in num:
		sha.update(str)
		dig = sha.hexdigest()
		ind = int(dig[0:2], 16)
		hashArr[ind] = hashArr[ind] + 1
	
	fin.close()
	print "hi iatHeaderHash"
	return hashArr
		


	
	
