fsverity-hash
Python implementation of fs-verity hash scheme.
Installation
python -mpip install fsverity-hash
Usage
FSVerityHash exposes a hashlib like interface
>>> import fsverity_hash
>>> m = fsverity_hash.FSVerityHash()
>>> m.update(b"Nobody inspects the spammish repetition")
>>> m.digest()
b'>\xd6s\xd52<\x9e\x1c`\x82\x0f td\xb0\xb8X\xa9\x0b\xa4\xff\x94\x0b\x12=\xd1kBV\x99\xce\xbe'
>>> m.hexdigest()
'3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe'
the fsverity digest command produces the same digest
$ echo -n "Nobody inspects the spammish repetition" > file.txt
$ fsverity digest file.txt
sha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe file.txt
The module exposes the same command line interface as fsverity digest
$ echo -n "Nobody inspects the spammish repetition" > spam.txt
$ fsverity digest spam.txt
sha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe spam.txt
$ python3 -m fsverity_hash spam.txt
sha256:3ed673d5323c9e1c60820f207464b0b858a90ba4ff940b123dd16b425699cebe spam.txt
$ python3 -m fsverity_hash --help
usage: fsverity_hash.py [-h] [--hash-alg {sha256,sha512}] [--block-size BYTES]
[--compact]
[FILE ...]
Compute fs-verity hashes
positional arguments:
FILE Input file(s) to process (default: stdin)
optional arguments:
-h, --help show this help message and exit
--hash-alg {sha256,sha512}
Merkle tree block hashing algorithm (default: sha256)
--block-size BYTES Merkle tree block size in bytes (default: 4096)
--compact Omit the hash algorithm name when printing digests
Limitations
- Upto 8 GiB can be hashed. This is an implementation limit, not a limitation of fs-verity hashes in general.
- Salted hashes aren't implemented.
- No automated tests.
- No testing of custom block sizes.
FSVerityHashobjects cannot be copied.
Other implementations
- https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
reference libfsverity implementation and
fsveritycommand - https://github.com/rvolgers/fs-verity-rs Rust crate
Further reading
Metadata
Release files for fsverity-hash 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fsverity-hash-0.0.5.tar.gz | 5.7 kB | Without provenance | Details for fsverity-hash-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fsverity_hash-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for fsverity_hash-0.0.5-py3-none-any.whl |
Total release size: 11.2 kB
Release files / fsverity-hash-0.0.5.tar.gz
| Download URL | fsverity-hash-0.0.5.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0bb679a010bd6df69fa705d97e3cb94feb2e30608237039e403298da230ae9f
|
|
BLAKE2b-256 checksum How to use checksums |
435726abf385272754a253822f8a5dd9692ce88e2e33e8d505164685101aa4a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / fsverity_hash-0.0.5-py3-none-any.whl
| Download URL | fsverity_hash-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f56eba3db850b15fefaea7885f7c4fbbf1c27f1cc70e3e1ae00dc21015a5bc1
|
|
BLAKE2b-256 checksum How to use checksums |
3b09962e59cbd67dd566c82e2dcfadea212f1055a496e6da932e6cbe0f87fa91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for fsverity-hash 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.