Skip to main content

A library to generate and validate RFC6920 URIs

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rfc6920-0.2.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rfc6920-0.2.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file rfc6920-0.2.2.tar.gz.

File metadata

  • Download URL: rfc6920-0.2.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.16

File hashes

Hashes for rfc6920-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a51d51cb3d2e5beb1633ea92a73b78cd89bef3a9611e1d252d33d79cbf5a00ca
MD5 cbcbb6441d64e19b0183d0bb6fa26d93
BLAKE2b-256 7a89f0fe1df8da3b739c756fdc7c93f4cdd02168ad21d4ec7bf597bbeb9d6902

See more details on using hashes here.

File details

Details for the file rfc6920-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rfc6920-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.16

File hashes

Hashes for rfc6920-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94acf6e522025a16850c6adb9a0472168ea7627789b44fe43534afa71647b58b
MD5 2e1ddb97aea72886a60716b341a46dca
BLAKE2b-256 f7643829af9ebd9a14cbf5094df69b5834c9a6a19eb70c54ec5f1444a52b455a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page