Expand description
Implementation of the Nilsimsa locality-sensitive hashing algorithm.
Compared to “traditional” hash functions (cryptographic or not), a small modification to the input does not substantially change the resulting hash. This crate contains the Nilsimsa utility to calculate Nilsimsa hash digests, as well as a compare function for given digests.
let mut hasher = Nilsimsa::new();
hasher.update("test string");
let digest = hasher.digest();
assert_eq!(
digest,
"42c82c184080082040001004000000084e1043b0c0925829003e84c860410010"
);
Structs§
- Utility to calculate Nilsimsa hash digests for arbitrarily long string inputs. See the crate-level documentation for an example of use.
Functions§
- Compare two hex digests with a Hamming distance calculation. Returns an
i16
in the range[-128, 128]
representing the similarity of the two input digests, where -128 is most dissimilar and 128 is most similar, or equal. The input strings must be of the same length.