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 | |
|---|---|---|---|
| hash_fixture-0.0.1.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hash_fixture-0.0.1-py2.p3-none-any.whl | p3, Python 2 | none | any | Details |
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
|