gem install hamming
Hamming calculates the distance between two hashes or two vectors.
Since hashes exist on a metric space you can measure how far a hash is from another.
hash_a = "859091ce633aaebb"
hash_b = "859091ce633aaeba"
Hamming.distance(hash_a, hash_b)
# You can also transform hashes based on your storage:
Hamming.vector_to_hash(hash)
Hamming.hash_to_vector(vector)