Skip to content

Commit

Permalink
descriptor: improve consistency in use of "digest"
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com>
  • Loading branch information
jonboulle committed Mar 13, 2017
1 parent 59ba145 commit 23af834
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The _digest_ property of a Descriptor acts as a content identifier, enabling [co
It uniquely identifies content by taking a [collision-resistant hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function) of the bytes.
If the digest can be communicated in a secure manner, one can retrieve the content from an insecure source, recalculate 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 (the "algorithm identifier") and a _hex_ portion (the digest).
The value of the digest property is a string consisting of an _algorithm_ portion (the "algorithm identifier") and a _hex_ portion.
The algorithm identifier specifies the cryptographic hash function used to calculate the digest; the hex portion is the lowercase hex-encoded result of the hash.

The digest string MUST match the following grammar:
Expand Down Expand Up @@ -96,7 +96,7 @@ let verified = ID(C) == D
```
Above, we define the content identifier as `ID(C)`, extracted from the `Descriptor.digest` field.
Content `C` is a string of bytes.
Function `H` returns the hash of `C` in bytes and is passed to function `EncodeHex` to obtain the _digest_.
Function `H` returns the hash of `C` in bytes and is passed to function `EncodeHex` and prefixed with the algorithm to obtain the digest.
The result `verified` is true if `ID(C)` is equal to `D`, confirming that `C` is the content identified by `D`.
After verification, the following is true:

Expand Down

0 comments on commit 23af834

Please sign in to comment.