{"id":16860523,"url":"https://github.com/moreati/fsverity-hash","last_synced_at":"2025-03-18T14:38:43.058Z","repository":{"id":65680285,"uuid":"597188780","full_name":"moreati/fsverity-hash","owner":"moreati","description":"fs-verity digest implementation for Python","archived":false,"fork":false,"pushed_at":"2023-02-27T20:37:18.000Z","size":16,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T07:47:39.657Z","etag":null,"topics":["file-integrity","fs-verity","fsverity","hashing-algorithm","hashlib"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/fsverity-hash/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moreati.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-02-03T20:33:27.000Z","updated_at":"2023-02-03T23:06:53.000Z","dependencies_parsed_at":"2024-11-24T20:11:43.148Z","dependency_job_id":"d8c93c14-44a2-41cf-8d5d-53cb42e92af5","html_url":"https://github.com/moreati/fsverity-hash","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"3668cde0e87071f0f2baec78aaba14c3be75de58"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moreati%2Ffsverity-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moreati%2Ffsverity-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moreati%2Ffsverity-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moreati%2Ffsverity-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moreati","download_url":"https://codeload.github.com/moreati/fsverity-hash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244242016,"owners_count":20421797,"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":["file-integrity","fs-verity","fsverity","hashing-algorithm","hashlib"],"created_at":"2024-10-13T14:25:02.394Z","updated_at":"2025-03-18T14:38:43.031Z","avatar_url":"https://github.com/moreati.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fsverity-hash\n\nPython implementation of [fs-verity] hash scheme.\n\n## Installation\n\n```\npython -mpip install fsverity-hash\n```\n\n## Usage\n\n`FSVerityHash` exposes a [hashlib] like interface\n```python\n\u003e\u003e\u003e import fsverity_hash\n\u003e\u003e\u003e m = fsverity_hash.FSVerityHash()\n\u003e\u003e\u003e m.update(b\"Nobody inspects the spammish repetition\")\n\u003e\u003e\u003e m.digest()\nb'\u003e\\xd6s\\xd52\u003c\\x9e\\x1c`\\x82\\x0f td\\xb0\\xb8X\\xa9\\x0b\\xa4\\xff\\x94\\x0b\\x12=\\xd1kBV\\x99\\xce\\xbe'\n\u003e\u003e\u003e m.hexdigest()\n'3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe'\n```\n\nthe `fsverity digest` command produces the same digest\n\n```\n$ echo -n \"Nobody inspects the spammish repetition\" \u003e file.txt\n$ fsverity digest file.txt\nsha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe file.txt\n```\n\nThe module exposes the same command line interface as `fsverity digest`\n\n```\n$ echo -n \"Nobody inspects the spammish repetition\" \u003e spam.txt\n$ fsverity digest spam.txt\nsha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe spam.txt\n$ python3 -m fsverity_hash spam.txt\nsha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe spam.txt\n$ python3 -m fsverity_hash --help\nusage: fsverity_hash.py [-h] [--hash-alg {sha256,sha512}] [--block-size BYTES]\n                        [--compact]\n                        [FILE ...]\n\nCompute fs-verity hashes\n\npositional arguments:\n  FILE                  Input file(s) to process (default: stdin)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --hash-alg {sha256,sha512}\n                        Merkle tree block hashing algorithm (default: sha256)\n  --block-size BYTES    Merkle tree block size in bytes (default: 4096)\n  --compact             Omit the hash algorithm name when printing digests\n```\n\n## Limitations\n\n- Upto 8 GiB can be hashed. This is an implementation limit, not a limitation of fs-verity hashes in general.\n- Salted hashes aren't implemented.\n- No automated tests.\n- No testing of custom block sizes.\n- `FSVerityHash` objects cannot be copied.\n\n## Other implementations\n- https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git\n  reference libfsverity implementation and `fsverity` command\n- https://github.com/rvolgers/fs-verity-rs Rust crate\n\n## Further reading\n- https://manpages.debian.org/testing/fsverity/fsverity.1.en.html\n- https://www.kernel.org/doc/html/v6.1/filesystems/fsverity.html\n\n[fs-verity]: https://www.kernel.org/doc/html/v6.1/filesystems/fsverity.html#file-digest-computation\n[hashlib]: https://docs.python.org/3/library/hashlib.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoreati%2Ffsverity-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoreati%2Ffsverity-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoreati%2Ffsverity-hash/lists"}