- rename "digester" vars that shadowed package-level digester type
- rename "hexdigestbytes" to be properly camelCase
- use "errors.Is()" instead of straight comparing errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Since b9e02e015be61903bbee58e3fd349114fa28e0b4, definition of algorithms was
distributed across two files, causing them to be documented in two separate
groups.
This patch:
- re-unifies all algorithms.
- improves documentation.
- adds doc-links to relevant specifications / reference material.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This adds a new interface to go-digest allowing for it to act as a registry
for various hash implementations. It includes the new "CryptoHash" interface
which hashers must implement. By default the SHA variants that were
historically available are available.
The cryptoHash interface mimics crypto.Hash, but is a subset of the methods
that we require. crypto.Hash is a concrete type that makes it hard to bring
new hash function implementations in.
The primary impetus is to allow for out-of-tree hash implementations to be
added. For example, if someone wanted to add the out-of-tree BLAKE3 AVX
implementation, they could do that. Right now, if two versions of the same
implementation are added, the one that is added first will take precedence,
but in the future, we can add the ability to force registration.
Signed-off-by: Sargun Dhillon <sargun@sargun.me>
We made a change to call the _hex_ portion the _encoded_ portion and
this makes a few updates to make that clearer for prospective users of
this package.
Signed-off-by: Stephen J Day <stephen.day@docker.com>