Metadata-Version: 2.1
Name: rfc6920
Version: 0.1.2
Summary: A library to generate and validate RFC6920 URIs
Home-page: https://github.com/inab/pyrfc6920
Author: José M. Fernández <https://orcid.org/0000-0002-4806-5140>
Author-email: jose.m.fernandez@bsc.es
License: LGPL-2.1
Project-URL: Bug Tracker, https://github.com/inab/pyrfc6920/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# A library to generate and validate RFC6920 URIs

Naming Things with Hashes [IETF RFC 6920](https://datatracker.ietf.org/doc/html/rfc6920) 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) and `validate` (to validate `ni` and `nih` URIs). Both `generate_ni`, `generate_nih` and `validate` understand both file paths and bytearray.

```python
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
```


