From 2d145196b5bbeac7e5640a6f14dd7e9babd2ed0b Mon Sep 17 00:00:00 2001
From: Manu Sporny
+
The [[?MULTIBASE]] specification has been dispatched at IETF and may be
standardized there. There is active discussion on this initiative in
the
@@ -1281,70 +1280,70 @@ Capability Delegation
-
- Multibase
+ Multibase
- Multibase
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.
-
+
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: -
- -Multibase Header | -Description | -||||||||
---|---|---|---|---|---|---|---|---|---|
`u` | -
+
|
+
+
Other Multibase encoding values MAY be used, but interoperability is not guaranteed between implementations using such values. -
+ -+
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. -
+ -+
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. -
+ - + -+
The [[?MULTIHASH]] specification has been dispatched at IETF and may be
standardized. There is active discussion on this initiative in
the
@@ -1355,76 +1354,77 @@ Multihash
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.
-
+
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: -
- -Multihash Identifier | -Multihash Header | -Description | -||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
`sha2-256` | -`0x12` | -
+
|
+
+
Other Multihash encoding values MAY be used, but interoperability is not guaranteed between implementations. -
+ -+
To encode to a Multihash value, an implementation MUST prepend the associated Multihash header value to the cryptographic hash value. -
+ -+
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. -
+ -