forked from TrueCloudLab/distribution
Formatting content digest calculation to avoid copyright symbols
- resolves #1197 Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
This commit is contained in:
parent
9c3c50faff
commit
17d4e82944
2 changed files with 20 additions and 20 deletions
|
@ -290,10 +290,11 @@ portion. The _algorithm_ identifies the methodology used to calculate the
|
||||||
digest. The _hex_ portion is the hex-encoded result of the hash.
|
digest. The _hex_ portion is the hex-encoded result of the hash.
|
||||||
|
|
||||||
We define a _digest_ string to match the following grammar:
|
We define a _digest_ string to match the following grammar:
|
||||||
|
```
|
||||||
digest := algorithm ":" hex
|
digest := algorithm ":" hex
|
||||||
algorithm := /[A-Fa-f0-9_+.-]+/
|
algorithm := /[A-Fa-f0-9_+.-]+/
|
||||||
hex := /[A-Fa-f0-9]+/
|
hex := /[A-Fa-f0-9]+/
|
||||||
|
```
|
||||||
|
|
||||||
Some examples of _digests_ include the following:
|
Some examples of _digests_ include the following:
|
||||||
|
|
||||||
|
@ -313,7 +314,6 @@ uniqueness of the _digest_ but some canonicalization may be performed to
|
||||||
ensure consistent identifiers.
|
ensure consistent identifiers.
|
||||||
|
|
||||||
Let's use a simple example in pseudo-code to demonstrate a digest calculation:
|
Let's use a simple example in pseudo-code to demonstrate a digest calculation:
|
||||||
|
|
||||||
```
|
```
|
||||||
let C = 'a small string'
|
let C = 'a small string'
|
||||||
let B = sha256(C)
|
let B = sha256(C)
|
||||||
|
@ -321,11 +321,11 @@ let D = 'sha256:' + EncodeHex(B)
|
||||||
let ID(C) = D
|
let ID(C) = D
|
||||||
```
|
```
|
||||||
|
|
||||||
Above, we have bytestring _C_ passed into a function, _SHA256_, that returns a
|
Above, we have bytestring `C` passed into a function, `SHA256`, that returns a
|
||||||
bytestring B, which is the hash of _C_. _D_ gets the algorithm concatenated
|
bytestring `B`, which is the hash of `C`. `D` gets the algorithm concatenated
|
||||||
with the hex encoding of _B_. We then define the identifier of _C_ to _ID(C)_
|
with the hex encoding of `B`. We then define the identifier of `C` to `ID(C)`
|
||||||
as equal to _D_. A digest can be verified by independently calculating _D_ and
|
as equal to `D`. A digest can be verified by independently calculating `D` and
|
||||||
comparing it with identifier _ID(C)_
|
comparing it with identifier `ID(C)`.
|
||||||
|
|
||||||
#### Digest Header
|
#### Digest Header
|
||||||
|
|
||||||
|
|
|
@ -290,10 +290,11 @@ portion. The _algorithm_ identifies the methodology used to calculate the
|
||||||
digest. The _hex_ portion is the hex-encoded result of the hash.
|
digest. The _hex_ portion is the hex-encoded result of the hash.
|
||||||
|
|
||||||
We define a _digest_ string to match the following grammar:
|
We define a _digest_ string to match the following grammar:
|
||||||
|
```
|
||||||
digest := algorithm ":" hex
|
digest := algorithm ":" hex
|
||||||
algorithm := /[A-Fa-f0-9_+.-]+/
|
algorithm := /[A-Fa-f0-9_+.-]+/
|
||||||
hex := /[A-Fa-f0-9]+/
|
hex := /[A-Fa-f0-9]+/
|
||||||
|
```
|
||||||
|
|
||||||
Some examples of _digests_ include the following:
|
Some examples of _digests_ include the following:
|
||||||
|
|
||||||
|
@ -313,7 +314,6 @@ uniqueness of the _digest_ but some canonicalization may be performed to
|
||||||
ensure consistent identifiers.
|
ensure consistent identifiers.
|
||||||
|
|
||||||
Let's use a simple example in pseudo-code to demonstrate a digest calculation:
|
Let's use a simple example in pseudo-code to demonstrate a digest calculation:
|
||||||
|
|
||||||
```
|
```
|
||||||
let C = 'a small string'
|
let C = 'a small string'
|
||||||
let B = sha256(C)
|
let B = sha256(C)
|
||||||
|
@ -321,11 +321,11 @@ let D = 'sha256:' + EncodeHex(B)
|
||||||
let ID(C) = D
|
let ID(C) = D
|
||||||
```
|
```
|
||||||
|
|
||||||
Above, we have bytestring _C_ passed into a function, _SHA256_, that returns a
|
Above, we have bytestring `C` passed into a function, `SHA256`, that returns a
|
||||||
bytestring B, which is the hash of _C_. _D_ gets the algorithm concatenated
|
bytestring `B`, which is the hash of `C`. `D` gets the algorithm concatenated
|
||||||
with the hex encoding of _B_. We then define the identifier of _C_ to _ID(C)_
|
with the hex encoding of `B`. We then define the identifier of `C` to `ID(C)`
|
||||||
as equal to _D_. A digest can be verified by independently calculating _D_ and
|
as equal to `D`. A digest can be verified by independently calculating `D` and
|
||||||
comparing it with identifier _ID(C)_
|
comparing it with identifier `ID(C)`
|
||||||
|
|
||||||
#### Digest Header
|
#### Digest Header
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue