hash-fixture
Produce lines of reproducible test fixture by repeated hashing.
For a given set of options the output is deterministic, it will always have the same checksum. So a large file can be reliably generated on demand, rather than downloaded or stored in version control. Conversely the expected checksum can be checked into version control, e.g. as part of a test suite.
Usage
>>> import hash_fixture
>>> lines = list(hash_fixture.lines(line_count=3))
>>> for line in lines: print(line)
b'000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\n'
b'000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=\n'
b'000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=\n'
>>>
>>> import hashlib
>>> hashlib.sha256(b''.join(lines)).hexdigest()
'3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f'
$ python3 -m hash_fixture --algorithm sha256 --line-count 3
000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=
000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=
$ python3 -m hash_fixture --algorithm sha256 --line-count 3 | sha256sum
3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f
Install
Use
python3 -m pip install hash-fixture
or
uv pip install hash-fixture
or copy hash_fixture.py somewhere convenient, it is a self contained script.
License
MIT
Metadata
Release files for hash-fixture 0.0.1
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 |
|---|---|---|---|---|
| hash_fixture-0.0.1.tar.gz | 8.4 kB | Without provenance | Details for hash_fixture-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hash_fixture-0.0.1-py2.p3-none-any.whl | p3, Python 2 | none | any | Details for hash_fixture-0.0.1-py2.p3-none-any.whl |
Total release size: 13.0 kB
Release files / hash_fixture-0.0.1.tar.gz
| Download URL | hash_fixture-0.0.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3512d069522c008953d3db08fb19be0dee55906aa8c72910b866e24c63cda2cb
|
|
BLAKE2b-256 checksum How to use checksums |
f67db3ba6e1ac031998a74901d5d56e639e2f18640414f55e82f58e423577ddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / hash_fixture-0.0.1-py2.p3-none-any.whl
| Download URL | hash_fixture-0.0.1-py2.p3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 2 p3 |
|
SHA-256 checksum How to use checksums |
d5123a59bfcf74c4254ff1877ba16e1064500fc0799abe04ac4939f0496462ee
|
|
BLAKE2b-256 checksum How to use checksums |
03691e2c0be91573d7ed61e19b3094974ecb60779e3325ce083e17a37508575f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for hash-fixture 0.0.1
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.