{"id":18417522,"url":"https://github.com/redcanaryco/rtlshtree","last_synced_at":"2026-02-27T23:32:13.487Z","repository":{"id":194405002,"uuid":"684196106","full_name":"redcanaryco/rtlshtree","owner":"redcanaryco","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-04T03:40:24.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-07-06T03:49:53.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redcanaryco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-28T16:44:03.000Z","updated_at":"2024-09-04T20:04:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"e32b5459-3182-4c87-9532-6086c1d0cfef","html_url":"https://github.com/redcanaryco/rtlshtree","commit_stats":null,"previous_names":["redcanaryco/rtlshtree"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redcanaryco/rtlshtree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redcanaryco%2Frtlshtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redcanaryco%2Frtlshtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redcanaryco%2Frtlshtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redcanaryco%2Frtlshtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redcanaryco","download_url":"https://codeload.github.com/redcanaryco/rtlshtree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redcanaryco%2Frtlshtree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29918980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T04:09:50.176Z","updated_at":"2026-02-27T23:32:13.466Z","avatar_url":"https://github.com/redcanaryco.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TLSH and TLSH Tree implementation in R\n\nThis repo contains an implementation of TLSH and a TLSH tree structure for\nefficiently searching for similar TLSH hashes.\n\n## References\n- Jonathan Oliver, Muqeet Ali, Josiah Hagen, \"[HAC-T and Fast Search for Similarity in Security](https://tlsh.org/papersDir/COINS_2020_camera_ready.pdf)\n- Jonathan Oliver, Chun Cheng and Yanggui Chen, “[TLSH - A Locality\n    Sensitive\n    Hash](https://github.com/trendmicro/tlsh/blob/master/TLSH_CTC_final.pdf)”\n    4th Cybercrime and Trustworthy Computing Workshop, Sydney, November\n    2013\n- Lucas Rist, [TLSH lib in Golang](https://github.com/glaslos/tlsh)\n\n## Installation\n\n```\ndevtools::install_github(\"redcanaryco/rtlshtree\")\n```\n\n## Usage\n\n`tlsh_diff(tlsh_a, tlsh_b)`\n\nCalculates the distance between two TLSH hashes.\n\n`tlsh_from_str(str_val)`\n\nCalculates the TLSH hash for a raw string input.\n\n`tlsh_from_strs(str_vector)`\n\nCalculate the TLSH hash for each raw string value in the vector. Returns a vector of TLSH hashes.\n\n`tlsh_n_pairs(50, tlsh_vector)`\n\nReturns the number of pairwise matches that are no more than a distance of 50 apart.\n\n`tlsh_tree_add(tree, tlsh)`\n\nAdds a TLSH hash to an existing TLSH tree. This will not change the structure of\nthe tree, only add the new TLSH to the appropriate leaf node.\n\n`tlsh_tree_delete(tree, tlsh)`\n\nRemoves a TLSH hash from an existing TLSH tree.\n\n`tlsh_tree_matches(tree, 50, tlsh_vector)`\n\nReturns a R List where each key points to a vector of TLSH matches.\n\n`tlsh_tree_n_matches(tree, 50 tlsh_vector)`\n\nReturns a vector of counts corresponding to the input tlsh_vector. The count is\nhow many matches were found in the tree for the give hash.\n\n`tlsh_tree_new(20, tlsh_vector)`\n\nCreates a new TLSH tree given a set of TLSH hashes, with the given leaf size.\n\n`tlsh_tree_info(tree)`\n\nReports basic information about the TLSH tree\n\n## Example\n\n```\nlibrary(tidyverse)\nlibrary(jsonlite)\nlibrary(tlshtree)\n\n# test.jsonl\n#   Structure: {\"raw\": \"...\"}\ndf \u003c- readLines(\"test.jsonl\") %\u003e%\n    lapply(fromJSON) %\u003e%\n    lapply(unlist) %\u003e%\n    bind_rows() %\u003e%\n    mutate(tlsh = tlsh_from_strs(raw))\n\ntlsh.tree \u003c- tlsh_tree_new(df$tlsh, 20)\n\ndf \u003c- df %\u003e%\n    mutate(num_matches = tlsh_tree_n_matches(tlsh.tree, tlsh, 50))\n\n# df \u003c- df[order(-num_matches), ]\n# knitr::kable(df, \"simple\")\n```\n\n## Development\n\nObviously, you'll need an installation of R. And you'll need to have the [devtools](https://github.com/r-lib/devtools) package installed.\n\nTo get started running the tests, git clone this repo and navigate to the project root and run the following:\n\n```\nRscript -e \"library(devtools); devtools::test()\"\n```\n\nFor debugging, you can start R with the `--debugger=\u003clldb/gdb\u003e` flag and any crashes will automatically start a debugger with symbols included.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredcanaryco%2Frtlshtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredcanaryco%2Frtlshtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredcanaryco%2Frtlshtree/lists"}