Fix HammingDist and add parityMatrix function