A Python package to create and parse Subresource Integrity values.
Installation
pip install subresource-integrity
Usage
Render an integrity value, given the content
>>> import subresource_integrity as integrity
>>> data = b"alert('Hello, world.');"
>>> integrity.render(data)
'sha384-H8BRh8j48O9oYatfu5AZzq6A9RINhZO5H16dQZngK7T62em8MUt1FLm52t+eX6xO'
Render multiple integrity values for the same content
>>> hashes = list(integrity.generate(data, ['sha384', 'sha256']))
>>> [str(h) for h in hashes] # doctest: +NORMALIZE_WHITESPACE
['sha384-H8BRh8j48O9oYatfu5AZzq6A9RINhZO5H16dQZngK7T62em8MUt1FLm52t+eX6xO',
'sha256-qznLcsROx4GACP2dm0UCKCzCG+HiZ1guq6ZZDob/Tng=']
Parse several space-delimited integrity values, and iterate of them
>>> parsed = integrity.parse(' sha256-47DEQpj8HBSa+/TImW+5JCeu'
... 'QeRkm5NMpJWZG3hSuFU= ')
>>> parsed # doctest: +ELLIPSIS
[subresource_integrity.Hash('sha256', '47DEQp...SuFU=', '')]
>>> [str(h) for h in parsed]
['sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=']
Metadata
Release files for subresource-integrity 0.2
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 |
|---|---|---|---|---|
| subresource-integrity-0.2.tar.gz | 5.0 kB | Without provenance | Details for subresource-integrity-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| subresource_integrity-0.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for subresource_integrity-0.2-py2.py3-none-any.whl |
Total release size: 10.9 kB
Release files / subresource-integrity-0.2.tar.gz
| Download URL | subresource-integrity-0.2.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36f4280c1b6ecdf6a6af79ed3f681f3e925d2a75d81d1051606ecbe561ad619a
|
|
BLAKE2b-256 checksum How to use checksums |
0073d0359c11775d1bdb7b3a044a34c0b0dd77db235c4f85df6c70be4785a391
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/2.7
|
Release files / subresource_integrity-0.2-py2.py3-none-any.whl
| Download URL | subresource_integrity-0.2-py2.py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f026c7cc940859e82c50268621b2755ffe32062079d66fc3d2801b01ffb05a7c
|
|
BLAKE2b-256 checksum How to use checksums |
4e56eebc12cd523f6f7b88c3c1a5c8034b7d86d75b1f8605dfeff63aff28268e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/2.7
|
Security for subresource-integrity 0.2
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.