tlsh_ts
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

This project is a port of Trend Micro Locality Sensitive Hash published in Github. It port an official Javascript version defined in https://github.com/trendmicro/tlsh/blob/master/js_ext/tlsh.js into Typescript with some code portion port from C++ version.

Usage example:

import {Tlsh} from "tlsh_ts"

let hasher = new Tlsh()

hasher.update("Some content.")
hasher.update("Some more content.")
hasher.finale("Some more content or padding to make it at least 50 bytes long.")
let hash = hasher.hash()
console.log(hash)

let otherHasher = new Tlsh()
otherHasher.update("Some content.")
otherHasher.update("Some more content.")
otherHasher.finale("Some more content or padding to make it at least 50 bytes long.")
let otherHash = otherHasher.hash()
console.log(otherHash)

let diffScore = hasher.totalDiff(otherHasher)
console.log(diffScore) // Should be 0

Package Sidebar

Install

npm i tlsh_ts

Weekly Downloads

192

Version

0.1.2

License

Apache-2.0

Unpacked Size

1.26 MB

Total Files

20

Last publish

Collaborators

  • s.nattapong