Fix hammingDistance to handle hex hashes (actually comparing the hashes - the tests would have passed on any data...) and move it into the lib itself.