Skip to content

malwaredb/lzjd2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Lint Crates.io Version

Lempel-Ziv Jaccard Distance

Rust implementation of Lempel-Ziv Jaccard Distance by Edward Raff.

Using it

Add this to your Cargo.toml:

[dependencies]
malwaredb-lzjd2 = "0.0.1"

One-liner to get a hash:

use malwaredb_lzjd2::lzjd::LzDigest;

let contents: Vec<u8> = b"Hello, world!".to_vec();
let lzjd_str = LzDigest::from(contents.as_ref()).to_string();

Compare hashes:

use malwaredb_lzjd2::lzjd::LzDigest;

let data1: Vec<u8> = b"Hello, world!".to_vec();
let data2: Vec<u8> = b"Hola amigo!".to_vec();

let lzjd1 = LzDigest::from(data1.as_ref());
let lzjd2 = LzDigest::from(data2.as_ref());

assert!(lzjd1.similarity(&lzjd2) > 0.5);

About

LZJD and other hashing algorithms

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors

Languages