Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 451 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 451 Bytes

Hamming

Install

gem install hamming

Usage

Hamming calculates the distance between two hashes or two vectors.

Distance

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)