Skip to content

Commit

Permalink
descriptor: Require lowercase hex
Browse files Browse the repository at this point in the history
Now that 75a51ed (fix regular expression of algorithim, 2016-08-30,
opencontainers#221) has made the Markdown and JSON Schema consistent (and required
lowercase algorithms), make digest comparisons easier by also
requiring lowercase hex.

This also:

* Makes it easier to serve blobs out of a case-insensitive filesystem
  store.
* Avoids having two otherwise-identical descriptor (or
  descriptor-containing) blobs with different hashes because they
  picked differend hex-casing.

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Sep 9, 2016
1 parent 5553ed5 commit 660d130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ It uniquely identifies content by taking a [collision-resistant hash](https://en
If the identifier can be communicated in a secure manner, one can retrieve the content from an insecure source, calculate the digest independently, and be certain that the correct content was obtained.

The value of the digest property, the _digest string_, is a serialized hash result, consisting of an _algorithm_ portion and a _hex_ portion.
The algorithm identifies the methodology used to calculate the digest; the hex portion is the hex-encoded result of the hash.
The algorithm identifies the methodology used to calculate the digest; the hex portion is the lowercase hex-encoded result of the hash.

The digest string matches the following grammar:
The digest string MUST match the following grammar:

```
digest := algorithm ":" hex
algorithm := /[a-z0-9_+.-]+/
hex := /[A-Fa-f0-9]+/
hex := /[a-f0-9]+/
```

Some example digest strings include the following:
Expand Down
2 changes: 1 addition & 1 deletion schema/defs-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"digest": {
"description": "the cryptographic checksum digest of the object, in the pattern '<hash>:<hexadecimal digest>'",
"type": "string",
"pattern": "^[a-z0-9_+.-]+:[a-fA-F0-9]+$"
"pattern": "^[a-z0-9_+.-]+:[a-f0-9]+$"
},
"manifestDescriptor": {
"id": "https://opencontainers.org/schema/image/manifestDescriptor",
Expand Down

0 comments on commit 660d130

Please sign in to comment.