{"id":30696633,"url":"https://github.com/adamliesko/tlsh","last_synced_at":"2025-09-02T08:44:25.251Z","repository":{"id":62559106,"uuid":"100652486","full_name":"adamliesko/tlsh","owner":"adamliesko","description":"TLSH (Trend Micro Locality Sensitive Hash) library for Ruby","archived":false,"fork":false,"pushed_at":"2017-08-28T17:21:14.000Z","size":562,"stargazers_count":25,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-01T11:52:58.130Z","etag":null,"topics":["fuzzy","gem","hashing","locality-sensitive-hashing","ruby","similarity-measurement","tlsh"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adamliesko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-17T23:12:39.000Z","updated_at":"2024-02-18T11:25:32.000Z","dependencies_parsed_at":"2022-11-03T11:15:51.701Z","dependency_job_id":null,"html_url":"https://github.com/adamliesko/tlsh","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/adamliesko/tlsh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamliesko%2Ftlsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamliesko%2Ftlsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamliesko%2Ftlsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamliesko%2Ftlsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamliesko","download_url":"https://codeload.github.com/adamliesko/tlsh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamliesko%2Ftlsh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273257786,"owners_count":25073531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["fuzzy","gem","hashing","locality-sensitive-hashing","ruby","similarity-measurement","tlsh"],"created_at":"2025-09-02T08:44:20.635Z","updated_at":"2025-09-02T08:44:25.218Z","avatar_url":"https://github.com/adamliesko.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/tlsh.svg)](https://badge.fury.io/rb/tlsh)\n[![Build Status](https://travis-ci.org/adamliesko/tlsh.svg?branch=master)](https://travis-ci.org/adamliesko/tlsh)\n[![Coverage Status](https://coveralls.io/repos/github/adamliesko/tlsh/badge.svg?branch=master)](https://coveralls.io/github/adamliesko/tlsh?branch=master)\n\n# TLSH - Trend Micro Locality Sensitive Hash\n  \nTLSH is a fuzzy matching library. Given a byte stream with a minimum length of 256 bytes, TLSH generates a hash value which can be used for similarity comparisons. Similar objects will have similar hash values which allow for the detection of similar objects by comparing their hash values. Note that the byte stream should have a sufficient amount of complexity. For example, a byte stream of identical bytes will not generate a hash value.\n\nThe computed hash is 35 bytes long (output as 70 hexadecimal characters). The first 3 bytes are used to capture the information about the file as a whole (length, ...), while the last 32 bytes are used to capture information about incremental parts of the file.\n\nDISCLAIMER: Based on [Trendmicro's TLSH](https://github.com/trendmicro/tlsh) and work of [glaslos](https://github.com/glaslos) Go port [tlsh](https://github.com/glaslos/tlsh).\n## Installation\n\n    $ gem install tlsh\n\n## Usage\n\nComputing a diff between two files\n```ruby\n\u003e Tlsh.diff_files('./../fixtures/test_file_1', './../fixtures/test_file_2')\n =\u003e 501\n```\n\nGetting a hash of a file\n```ruby\n\u003e t1 = Tlsh.hash_file('./../fixtures/test_file_1')\n =\u003e #\u003cTlsh::TlshInstance:0x007ffad6ae32c8 @checksum=232, @l_value=13, @q1_ratio=2, @q2_ratio=2, @q_ratio=34, @body=[2, 252, 48, 128, 35, 3, 160, 2, 176, 59, 51, 48, 15, 195, 10, 130, 248, 48, 8, 194, 250, 0, 10, 0, 128, 184, 186, 14, 2, 204, 160, 195]\u003e \n\u003e t1.string.to_s\n =\u003e \"b2317c38fac0333c8ff7d3ff31fcf3b7fb3f9a3ef3bf3c880cfc43ebf97f3cc73fbfc\"\n```\n\nComparing hashes between each other\n```ruby\n\u003e t1 = Tlsh.hash_file('./../fixtures/test_file_1')\n =\u003e #\u003cTlsh::TlshInstance:0x007ffad6ae32c8 @checksum=232, @l_value=13, @q1_ratio=2, @q2_ratio=2, @q_ratio=34, @body=[2, 252, 48, 128, 35, 3, 160, 2, 176, 59, 51, 48, 15, 195, 10, 130, 248, 48, 8, 194, 250, 0, 10, 0, 128, 184, 186, 14, 2, 204, 160, 195]\u003e \n\u003e t2 = Tlsh.hash_file('./../fixtures/test_file_2')\n =\u003e #\u003cTlsh::TlshInstance:0x007ffad79f1e90 @checksum=232, @l_value=13, @q1_ratio=2, @q2_ratio=2, @q_ratio=34, @body=[2, 252, 48, 128, 35, 3, 160, 2, 176, 59, 51, 48, 15, 195, 10, 130, 248, 48, 8, 194, 250, 0, 10, 0, 128, 184, 186, 14, 2, 204, 160, 195]\u003e\n\u003e t1.diff(t2)\n =\u003e 488\n```\n\nGetting a hash of bytes\n```ruby\n\u003e Tlsh.hash_bytes([11,4,...2])\n =\u003e #\u003cTlsh::TlshInstance:0x007fddf7cf7f60 @checksum=77, @l_value=13, @q1_ratio=1, @q2_ratio=2, @q_ratio=18, @code=[113, 234, 243, 233, 185, 240, 180, 207, 123, 159, 195, 238, 7, 74, 14, 114, 59, 50, 55, 62, 226, 73, 19, 139, 133, 104, 235, 187, 195, 173, 42, 122]\u003e\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/adamliesko/tlsh. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [Apache](https://opensource.org/licenses/Apache-2.0).\n\n## Code of Conduct\n\nEveryone interacting in the Tlsh project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/adamliesko/tlsh/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamliesko%2Ftlsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamliesko%2Ftlsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamliesko%2Ftlsh/lists"}