Crate malwaredb_lzjd

source ·
Expand description

§LZJD

Rust implementation of the LZJD algorithm See also: https://github.com/EdwardRaff/jLZJD

Any core::hash::BuildHasher is supported, just pass a &BuildHasher to LZDict::from_bytes_stream. For convenience, this crate provides a wrapper around the crc32 hasher which implements BuildHasher.

§Example

let stream_a = b"bitsandpieces".iter().cloned();
let stream_b = b"doctestbits".iter().cloned();
let k = 1024;

let build_hasher = CRC32BuildHasher;

let dict_a = LZDict::from_bytes_stream(stream_a, &build_hasher);
let dict_b = LZDict::from_bytes_stream(stream_b, &build_hasher);

let lzjd = dict_a.dist(&dict_b);

assert_eq!(lzjd, 0.5714285714285714);

Re-exports§

  • pub use crate::lz_dict::LZDict;

Modules§

  • crc32 wrapper; Defines a wrapper around crc::crc32::Digest, implementing std::hash::Hasher as well as a std::hash::BuildHasher which builds the hasher.
  • LZ dictionary implementation

Structs§

Enums§

Type Aliases§