pmatigakis / lshashes

Library with implementations of locality sensitive hashes in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The lshashes library provides implementation of several locality sensitive hashes. The following hash functions are available.

Installation

Build the library using gradle.

./gradlew jar

The jar file will be created at the build/libs directory.

Examples

TLSH

import com.matigakis.lshashes.hashes.tlsh.Data;
import com.matigakis.lshashes.hashes.tlsh.Text;
import com.matigakis.lshashes.hashes.tlsh.Tlsh;
import com.matigakis.lshashes.hashes.tlsh.TlshCalculator;

public class TlshExample {
    public static void main(String[] args) {
        Data data = Text.create(
                "Lorem ipsum dolor sit amet, consectetur " +
                "adipiscing elit. Sed congue pharetra cursus. Mauris eu " +
                "semper ante, vel faucibus leo. Interdum et malesuada fames " +
                "ac ante ipsum primis in faucibus");

        TlshCalculator calculator = TlshCalculator.create();
        Tlsh tlsh = calculator.calculate(data);

        System.out.println(tlsh.toHex());
   }
}

About

Library with implementations of locality sensitive hashes in Java

License:MIT License


Languages

Language:Java 100.0%