Added average hash implementation and hamming distance function.