Crates.io | tlsh-fixed |
lib.rs | tlsh-fixed |
version | 0.1.1 |
source | src |
created_at | 2023-02-24 10:51:35.979668 |
updated_at | 2023-02-24 10:51:35.979668 |
description | Rust port of Trend Micro Locality Sensitive Hashing |
homepage | |
repository | https://github.com/Uinelj/tlsh-rs.git |
max_upload_size | |
id | 793470 |
size | 438,828 |
This is a Rust port of Trend Micro Locality Sensitive Hash (TLSH) [github], [website] algorithm to compute a hash value of a byte stream. These generated hash values can then be used for similarity detection, data clustering or nearest neighbour search.
The algorithm to construct a TLSH digest is as follows (for more detail, see [1]):
q1
: the lowest 25% of the array
q2
: the lowest 50% of the array
q3
: the lowest 75% of the arrayq1_ratio <<< 4 | q2_ratio
, where
q1_ratio = (q1 * 100 / q3) MOD 16
q2_ratio = (q2 * 100 / q3) MOD 16
The example examples/tlsh_files.rs
shows how we calculate hash values from files and measure their difference (distance). To run the example, use the following command in command line:
cargo run --release --example tlsh_files ../path/to/folder/with/files
[1] J. Oliver, C. Cheng and Y. Chen (2013). "TLSH - A Locality Sensitive Hash" [pdf].
TLSH is provided for use under two licenses: Apache OR BSD. Users may opt to use either license depending on the license restictions of the systems with which they plan to integrate the TLSH code.