fs-verity digest implementation for Python
Project description
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
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 or SHA512 algorithm.
FSVerityHash
objects cannot be copied.
Other implementations
- https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git
reference libfsverity implementation and
fsverity
command - https://github.com/rvolgers/fs-verity-rs Rust crate
Further reading
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fsverity-hash-0.0.3.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file fsverity-hash-0.0.3.tar.gz
.
File metadata
- Download URL: fsverity-hash-0.0.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5794b73b69f60f35ac3ea81a123c2008a79b400cc08444549662faeed2775940 |
|
MD5 | 766fb64fbf044bba5e0639d14a48518c |
|
BLAKE2b-256 | 6c4a94e0742e76cf58a20accd19c0913a0ee6d70844a1d58a9896ae587187308 |
File details
Details for the file fsverity_hash-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: fsverity_hash-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fff878a85891f2be1848516e6c9a9a203e6a885ae8a3c12ea27dd0c2e96b58d |
|
MD5 | bf0ac940dd08c27edfb3527c2abef78a |
|
BLAKE2b-256 | 0f4830a4a58aeaa7eb1e7315327061b03d5eb9a6409f9cbe13edb4c762db5926 |