Skip to main content

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

Further reading

Project details


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.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

fsverity_hash-0.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file fsverity-hash-0.0.2.tar.gz.

File metadata

  • Download URL: fsverity-hash-0.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fsverity-hash-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5e290e60bd418024d7f6aeff8704bd0756dc92b449fc1b4fb57a4b71a5d21a58
MD5 fb76248e6631e27d6aba43d60b3c1105
BLAKE2b-256 46f4577f8a397c8511d3bd7b45a44d7164fde13c02da45f6c3739b2a0e474819

See more details on using hashes here.

File details

Details for the file fsverity_hash-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fsverity_hash-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4f72cbf48c5f5da0d51b3bd15356602e914dd624ab9bc62619b637437912a03
MD5 da2443454725f8b7fa62abd12024a0aa
BLAKE2b-256 f552a18a778c169f79488550ea4e1375b2de71e6803c3a2c7fd0a2cf8828ad7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page