Skip to main content

A library to generate and validate RFC6920 URIs

Naming Things with Hashes IETF RFC 6920 specifies both ni and nih schemes, and how they are generated and validated.

This library is composed by methods generate_ni (to generate a ni URI), generate_nih (to generate a nih URI), extract_digest (to get back both the digest and the hashing algorithm) and validate (to validate ni and nih URIs). Both generate_ni, generate_nih and validate understand both file paths and bytearray.

rfc6920.generate_nih(b'Hello World!') 
# It returns 'nih:sha-256;7f83-b165-7ff1-fc53-b92d-c181-48a1-d65d-fc2d-4b1f-a3d6-7728-4add-d200-126d-9069;d'

rfc6920.validate('nih:sha-256;7f83-b165-7ff1-fc53-b92d-c181-48a1-d65d-fc2d-4b1f-a3d6-7728-4add-d200-126d-9069;d', b'Hello World!')
# It returns True

rfc6920.validate('nih:sha-256;7f83-b165-7ff1-fc53-b92d-c181-48a1-d65d-fc2d-4b1f-a3d6-7728-4add-d200-126d-9069;e', b'Hello World!')
# It returns False, wrong check digit

rfc6920.validate('nih:sha-256;7f83-b165-7ff1-fc53-b92d-c181-48a1-d65d-fc2d-4b1f-a3d6-7728-4add-d200-126d-9069;d', b'Hello Mundo!')
# It returns False, different digest

Metadata

Release files for rfc6920 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rfc6920 0.2.2
File Size Uploaded Provenance Actions
rfc6920-0.2.2.tar.gz 14.4 kB Without provenance Details for rfc6920-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rfc6920 0.2.2
File Interpreter ABI Platform Actions
rfc6920-0.2.2-py3-none-any.whl Python 3 none any Details for rfc6920-0.2.2-py3-none-any.whl

Total release size: 29.6 kB

Release files / rfc6920-0.2.2.tar.gz

Download URL rfc6920-0.2.2.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a51d51cb3d2e5beb1633ea92a73b78cd89bef3a9611e1d252d33d79cbf5a00ca
BLAKE2b-256 checksum
How to use checksums
7a89f0fe1df8da3b739c756fdc7c93f4cdd02168ad21d4ec7bf597bbeb9d6902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.16

Release files / rfc6920-0.2.2-py3-none-any.whl

Download URL rfc6920-0.2.2-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94acf6e522025a16850c6adb9a0472168ea7627789b44fe43534afa71647b58b
BLAKE2b-256 checksum
How to use checksums
f7643829af9ebd9a14cbf5094df69b5834c9a6a19eb70c54ec5f1444a52b455a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.16

Security for rfc6920 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page