1
0
mirror of https://github.com/opencontainers/go-digest.git synced 2025-07-04 20:42:25 +03:00

18 Commits

Author SHA1 Message Date
528a66390c do not register sha384 by default
The SHA-384 algorithm is not documented in the OCI image-spec ([1], [2]), and
is not encouraged to be used. Commit 084376bb54
registered all algorithms by default, but also included SHA-384.

This patch disables SHA-384 by default, to discourage its use.

[1]: https://github.com/opencontainers/image-spec/blob/v1.0.2/descriptor.md#digests
[2]: https://github.com/opencontainers/image-spec/blob/v1.0.2/descriptor.md#registered-algorithms

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-16 00:55:11 +01:00
38caa322a4 RegisterAlgorithm: skip regex if not needed
No need to validate the format if we previously accepted it to be
registered.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 14:13:34 +02:00
a1f6e2eda3 address some linting issues
- 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>
2024-07-02 13:22:02 +02:00
8e0b8045c6 unify algorithms in a single list, and improve documentation
Since b9e02e015b, 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>
2024-01-30 11:59:42 +01:00
b03a7a20db fix: code optimization
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-05-29 22:55:39 +08:00
718acf6e65 gofmt code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 13:45:17 +01:00
a63e545fe7 Add BLAKE3 support
This adds support for the BLAKE3 hash family with a default output
size of 256-bit.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2021-05-07 12:40:20 -07:00
b9e02e015b Implement dynamic hash registration
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>
2021-04-21 11:34:35 -07:00
264d27f5bd *: add OCI copyright
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2020-01-20 11:09:29 -05:00
4ca13015b6 disallow upper characters (/A-F/) in hex-encoded portion
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-06-07 02:49:32 +00:00
55f675811a digest: update package methods to reflect changes
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>
2017-04-25 14:07:33 -07:00
b6234c321f *: add LICENSE headers to Go files
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-30 15:27:15 -08:00
fe5ffa6d5f algorithm: More New removal
The remaining New on a cytpo.Hash, so it stays.

Signed-off-by: W. Trevor King <wking@tremily.us>
2016-12-16 16:37:56 -08:00
2616283261 digest: remove last of deprecated methods
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-12-16 16:25:17 -08:00
5cc775298e Fix small lint and unit test issues
Pull request ci was not running and caused these
minor issues to not be caught.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-12-15 22:38:38 -08:00
f8e420604f digest: better test coverage
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-12-15 17:33:33 -08:00
2e6b5ec584 digest: remove error return from Digest.Verifier
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-12-15 16:43:59 -08:00
1bb0bb7764 digest: cleanup digester and verifier creation
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-12-15 15:17:21 -08:00