Skip to content

Commit

Permalink
descriptor: Define the 'sha256' algo identifier
Browse files Browse the repository at this point in the history
Before this commit, there wasn't something obvious to point to if you
wanted to explain the sha256 identifier.

The "SHOULD be submitted" wording follows runtime-spec's example [1].

[1]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc4/config.md#platform

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Feb 28, 2017
1 parent 9819eae commit ed89aca
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ hex := /[a-f0-9]+/

Some example digest strings include the following:

digest | description |
----------------------------------------------------------------------------------|------------------------------------------------
sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b | Common sha256 based digest |
digest | algorithm |
------------------------------------------------------------------------|---------------------|
sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b | [SHA-256](#sha-256) |

Before consuming content targeted by a descriptor from untrusted sources, the byte content SHOULD be verified against the digest.
Before calculating the digest, the size of the content SHOULD be verified to reduce hash collision space.
Expand Down Expand Up @@ -109,6 +109,16 @@ D == ID(C) == '<alg>:' + EncodeHex(H(C))

The _digest_ is confirmed as the content identifier by independently calculating the _digest_.

#### Registered identifiers

The following algorithm identifiers are defined by this specification:

| identifier | algorithm |
|------------|---------------------|
| `sha256` | [SHA-256](#sha-256) |

If a useful algorithm is not included in the above table, it SHOULD be submitted to this specification for standardization.

#### SHA-256

[SHA-256](https://tools.ietf.org/html/rfc4634#page-7) is a collision-resistant hash function, chosen for ubiquity, reasonable size and secure characteristics.
Expand Down

0 comments on commit ed89aca

Please sign in to comment.