Skip to content

Clean TLSH using Modern C++ (with Python 3.8+ bindings)

License

Notifications You must be signed in to change notification settings

calladoum-elastic/tlsh

 
 

Repository files navigation

TLSH

Build Test

Build

Build & Install the C++ library

Requires cmake (>= 3.20), and a C++20-compatible compiler.

cmake -S . -B ./build
cmake --build ./build --config RelWithDebInfo
cmake --install ./build --config RelWithDebInfo

Build & Install the Python bindings

Requires Python3.8+

Install requirements, then the package (also requires cmake and a C++ compiler)

python -m pip install -r python/requirements.txt --user --upgrade
python -m pip install . --user --upgrade

Usage

Python

Example

import tlsh
import random

def rand(n):
  return bytearray([ random.randint(0, 255) for x in range(n) ])

a = tlsh.Tlsh()
for i in range( 10 ) :
    a.update(bytes(rand(256)))
a.final()

print(f"{bool(a)=}")
if a:
  print(f"Result is: {a.hexdigest()}")

print(f"{tlsh.hexdigest(rand(1024))=}")
print(f"{tlsh.digest(rand(1024))=}")

About

Clean TLSH using Modern C++ (with Python 3.8+ bindings)

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • C++ 86.9%
  • C 6.4%
  • Python 3.0%
  • Go 2.0%
  • CMake 1.7%