Skip to content

Commit

Permalink
Move Multibase and Multihash sections into Data Model section.
Browse files Browse the repository at this point in the history
  • Loading branch information
msporny committed Jun 2, 2024
1 parent f127279 commit 2d14519
Showing 1 changed file with 85 additions and 85 deletions.
170 changes: 85 additions & 85 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1264,13 +1264,12 @@ <h2>Capability Delegation</h2>
</pre>
</section>
</section>
</section>

<section>
<h2>Multibase</h2>
<section>
<h2>Multibase</h2>

<p class="issue"
title="Multibase may be standardized at IETF">
<p class="issue"
title="Multibase may be standardized at IETF">
The [[?MULTIBASE]] specification has been dispatched at IETF and may be
standardized there. There is active discussion on this initiative in
the <a href="https://mailarchive.ietf.org/arch/browse/multiformats/">
Expand All @@ -1281,70 +1280,70 @@ <h2>Multibase</h2>
alignment between the Multibase values used in this specification and the
Multibase values defined by the current Multibase community and any potential
future IETF Multiformats Working Group.
</p>
</p>

<p>
<p>
A Multibase string includes a single character header which identifies the
base and encoding alphabet used to encode a binary value, followed by the
encoded binary value (using that base and alphabet). The common Multibase
header values and their associated base encoding alphabets as provided below
are normative:
</p>

<table class="simple">
<thead>
<tr>
<th>Multibase&nbsp;Header</th>
<th>Description</th>
</tr>
</thead>
</p>

<tbody>
<tr>
<td>`u`</td>
<td>
<table class="simple">
<thead>
<tr>
<th>Multibase&nbsp;Header</th>
<th>Description</th>
</tr>
</thead>

<tbody>
<tr>
<td>`u`</td>
<td>
The base-64-url-no-pad alphabet is used to encode the bytes. The base-alphabet
consists of the following characters, in order:
`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`
</td>
</tr>
<tr>
<td>`z`</td>
<td>
</td>
</tr>
<tr>
<td>`z`</td>
<td>
The base-58-btc alphabet is used to encode the bytes. The base-alphabet consists
of the following characters, in order:
`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

<p>
<p>
Other Multibase encoding values MAY be used, but interoperability is not
guaranteed between implementations using such values.
</p>
</p>

<p>
<p>
To base-encode a binary value into a Multibase string, an implementation MUST
apply the algorithm in Section [[[#base-encode]]] to the binary value,
with the desired base encoding and alphabet from the table above, ensuring to
prepend the associated Multibase header from the table above to the result.
Any algorithm with equivalent output MAY be used.
</p>
</p>

<p>
<p>
To base-decode a Multibase string, an implementation MUST apply the algorithm
in Section [[[#base-decode]]] to the string following the first
character (Multibase header), with the alphabet associated with the
Multibase header. Any algorithm with equivalent output MAY be used.
</p>
</p>

</section>
</section>

<section>
<h2>Multihash</h2>
<section>
<h2>Multihash</h2>

<p class="issue" title="Multihash may be standardized at IETF">
<p class="issue" title="Multihash may be standardized at IETF">
The [[?MULTIHASH]] specification has been dispatched at IETF and may be
standardized. There is active discussion on this initiative in
the <a href="https://mailarchive.ietf.org/arch/browse/multiformats/">
Expand All @@ -1355,76 +1354,77 @@ <h2>Multihash</h2>
alignment between the Multihash values used in this specification and the
Multihash values defined by the current Multihash community and any potential
future IETF Multiformats Working Group.
</p>
</p>

<p>
<p>
A Multihash value starts with a binary header, which identifies the specific
cryptographic hash algorithm and parameters used to generate the digest,
followed by the cryptographic digest value. The normative Multihash header
values defined by this specification, and their associated output sizes and
associated specifications, are provided below:
</p>

<table class="simple">
<thead>
<tr>
<th>Multihash&nbsp;Identifier</th>
<th>Multihash&nbsp;Header</th>
<th>Description</th>
</tr>
</thead>
</p>

<tbody>
<tr>
<td>`sha2-256`</td>
<td>`0x12`</td>
<td>
<table class="simple">
<thead>
<tr>
<th>Multihash&nbsp;Identifier</th>
<th>Multihash&nbsp;Header</th>
<th>Description</th>
</tr>
</thead>

<tbody>
<tr>
<td>`sha2-256`</td>
<td>`0x12`</td>
<td>
SHA-2 with 256 bits (32 bytes) of output, as defined by [[RFC6234]].
</td>
</tr>
<tr>
<td>`sha2-384`</td>
<td>`0x20`</td>
<td>
</td>
</tr>
<tr>
<td>`sha2-384`</td>
<td>`0x20`</td>
<td>
SHA-2 with 384 bits (48 bytes) of output, as defined by [[RFC6234]].
</td>
</tr>
<tr>
<td>`sha3-256`</td>
<td>`0x16`</td>
<td>
</td>
</tr>
<tr>
<td>`sha3-256`</td>
<td>`0x16`</td>
<td>
SHA-3 with 256 bits (32 bytes) of output, as defined by [[SHA3]].
</td>
</tr>
<tr>
<td>`sha3-384`</td>
<td>`0x15`</td>
<td>
</td>
</tr>
<tr>
<td>`sha3-384`</td>
<td>`0x15`</td>
<td>
SHA-3 with 384 bits (48 bytes) of output, as defined by [[SHA3]].
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

<p>
<p>
Other Multihash encoding values MAY be used, but interoperability is not
guaranteed between implementations.
</p>
</p>

<p>
<p>
To encode to a Multihash value, an implementation MUST prepend the associated
Multihash header value to the cryptographic hash value.
</p>
</p>

<p>
<p>
To decode a Multihash value, an implementation MUST remove the prepended
Multihash header value, which identifies the type of cryptographic hashing
algorithm as well as its output length, leaving the raw cryptographic hash
value which MUST match the output length associated with the Multihash header.
</p>
</p>

</section>
</section>

</section>

<section>
<h2>Contexts and Vocabularies</h2>
Expand Down

0 comments on commit 2d14519

Please sign in to comment.