{"id":26052529,"url":"https://github.com/qalle2/binary-diff","last_synced_at":"2025-06-29T16:37:50.329Z","repository":{"id":171908763,"uuid":"245739269","full_name":"qalle2/binary-diff","owner":"qalle2","description":"Compare two binary files.","archived":false,"fork":false,"pushed_at":"2024-07-09T01:13:51.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-08T06:42:08.534Z","etag":null,"topics":["binary-files","command-line","diff","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qalle2.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":"2020-03-08T02:30:00.000Z","updated_at":"2024-07-09T01:13:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb7e19e2-1278-4dca-9884-69cf40ab2cd0","html_url":"https://github.com/qalle2/binary-diff","commit_stats":null,"previous_names":["qalle2/binary-diff"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qalle2/binary-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qalle2%2Fbinary-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qalle2%2Fbinary-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qalle2%2Fbinary-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qalle2%2Fbinary-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qalle2","download_url":"https://codeload.github.com/qalle2/binary-diff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qalle2%2Fbinary-diff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262628165,"owners_count":23339738,"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","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":["binary-files","command-line","diff","python3"],"created_at":"2025-03-08T06:40:52.893Z","updated_at":"2025-06-29T16:37:50.263Z","avatar_url":"https://github.com/qalle2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# binary-diff\nCompare two binary files. The algorithm: repeatedly find the longest prefix of file 1 in file 2, advance in file 1 and mark the addresses in file 2 as used.\n\nTable of contents:\n* [Command line arguments](#command-line-arguments)\n* [Output format](#output-format)\n* [Examples](#examples)\n* [To do](#to-do)\n\n## Command line arguments\n*options* *file1* *file2*\n* *options*: Zero or more of the following, separated by spaces:\n  * `-m N` or `--min-match-len N`: Only find matches of at least `N` bytes.\n    * `N` is a positive integer.\n    * The default is 8.\n  * `-d N` or `--max-distance N`: Do not find matches whose addresses differ by more than `N` bytes.\n    * `N` is -1 or a greater integer.\n    * -1 means there is no limit.\n    * The default is -1.\n    * This option is experimental! It will let many matches through that don't fulfill the requirement. It should not eliminate correct matches anymore, however.\n  * `-t` or `--tabular`: See \"Output format\" below.\n  * `-p` or `--progress`: Print messages that indicate progress.\n* *file1* and *file2*: Two binary files to compare.\n  * Neither file may be empty.\n  * The files need not be the same size.\n\n## Output format\nIf the `-t` or `--tabular` option is not specified, the output lines will consist of three integers separated by commas: position in file 1, position in file 2, length. If one of the positions is empty, the line denotes an unmatched chunk, otherwise a match. Positions start from 0. E.g. `10,20,3` means bytes 10\u0026ndash;12 in file 1 are identical to bytes 20\u0026ndash;22 in file 2, and `40,,5` means no match in file 2 was found for bytes 40\u0026ndash;44 in file 1.\n\nIf the `-t` or `--tabular` option is specified, the results will be printed as a table of inclusive hexadecimal address ranges instead.\n\n## Examples\nSuppose we have the following files:\n* `a.txt`: `abcdefgh ijklmnop qrstuvwx ABCDEFGH`\n* `b.txt`: `ijklmnop abcdefgh qrstuvwx IJKLMNOP`\n\nThe command `python3 binary_diff.py a.txt b.txt` will print:\n```\n\"position in file1\",\"position in file2\",\"length\"\n0,9,9\n9,0,9\n18,18,9\n27,,8\n,27,8\n```\n\nThe command `python3 binary_diff.py --tabular a.txt b.txt` will print:\n```\nfile1        0-       8 = file2        9-      11\nfile1        9-      11 = file2        0-       8\nfile1       12-      1a = file2       12-      1a\nfile1       1b-      22 = file2 (nothing)\nfile1 (nothing)         = file2       1b-      22\n```\n\n## To do\n* Fix the `--max-distance` option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqalle2%2Fbinary-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqalle2%2Fbinary-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqalle2%2Fbinary-diff/lists"}