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

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
rfc6920-0.2.2.tar.gz 14.4 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.3

2 release files

0.1.2

2 release files

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