[][src]Crate nilsimsa

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

Nilsimsa

Utility to calculate Nilsimsa hash digests for arbitrarily long string inputs. See the crate-level documentation for an example of use.

Functions

compare

Compare two hex digests with a Hamming distance calculation. Returns an unsigned 8-bit integer in the range [0, 128] representing the similarity of the two input digests, where 0 is most dissimilar and 128 is most similar, or equal. The input strings must be of the same length.