Skip to content

Instantly share code, notes, and snippets.

@rjzak
Last active June 14, 2026 22:16
Show Gist options
  • Select an option

  • Save rjzak/5fc7280c22841da09400c46edce2d956 to your computer and use it in GitHub Desktop.

Select an option

Save rjzak/5fc7280c22841da09400c46edce2d956 to your computer and use it in GitHub Desktop.
Use similarity hashes to find potentially related samples
select sha1_a, sha1_b, ssdeep_sim, lzjd_sim, tlsh_sim
from (
select
fileA.sha1 as sha1_a,
fileB.sha1 as sha1_b,
fuzzy_hash_compare(fileA.ssdeep, fileB.ssdeep) as ssdeep_sim,
lzjd_compare(fileA.lzjd, fileB.lzjd) as lzjd_sim,
tlsh_compare(fileA.tlsh, fileB.tlsh) as tlsh_sim
from file as fileA
join file as fileB on fileA.id != fileB.id
) sims
where ssdeep_sim > 20 or lzjd_sim > 20
or (tlsh_sim < 100 and tlsh_sim > 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment