You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to encode/decode Multibase and Multicodec strings. (I have included these two methods as one feature request, as I believe they are intricately linked).
Block: Multibase Input: (text) z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK Output: (encoding) Base58 Bitcoin (because the leading byte is z, as per the Multibase table) Output: (bytes) ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Block: Multicodec Input: (bytes) ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6 Output: (represents) Ed25519 public key (because the leading bytes are 0xed, as per the Multicodec spec) Output: (bytes) 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Block: Multibase Input: (bytes) ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6 Input: (encoding) Base64 URL, no padding Output: (text) u7QEub8zjZwHceRSI4NCxdFzB4zpMHJ_MQcY700Pbvglw5g
Block: Multibase Input: (bytes) ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6 Input: (encoding) z-base-32 Output: (text) h7wy1h56chpuodzd3n1rqbwftqtqcda34joqj9unbaa77go65zarzb3o
Note
This demonstrates that the above z6Mkha…, u7QEub…, and h7wy1h… strings are functionally identical as an Ed25519 public key to any system that can parse Multibase + Multicodec strings.
Describe a concrete use case
Multibase and Multicodec encoding are used increasingly frequently, particularly in distributed computing, as they are self describing in their encodings (making them very future compatible). (They are used for the content addressed IDs of IPFS, the format of the did:key distributed ID method, and many other spaces — Multibase is also an active IETF draft).
I regulary interact with strings that could be Multibase + Multicodec encoded, but find myself having to manually decode them to (a) determine if they're valid/really are Multibase, (b) to extract the "lookup byte" and manually check what the string represents, and/or (c) to re-encode them with a different base. It would be immensely useful if cipher editor allowed me to break apart and rebuild a multicodec with a few clicks!
Implementation
There is an official Multiformat JS library that covers all the encoding/decoding needed: multiformats/js-multiformats
The text was updated successfully, but these errors were encountered:
Describe your feature or enhancement suggestion
I'd like to be able to encode/decode Multibase and Multicodec strings. (I have included these two methods as one feature request, as I believe they are intricately linked).
Block: Multibase
Input: (text)
z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
Output: (encoding)
Base58 Bitcoin
(because the leading byte isz
, as per the Multibase table)Output: (bytes)
ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Block: Multicodec
Input: (bytes)
ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Output: (represents)
Ed25519 public key
(because the leading bytes are0xed
, as per the Multicodec spec)Output: (bytes)
01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Block: Multibase
Input: (bytes)
ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Input: (encoding)
Base64 URL, no padding
Output: (text)
u7QEub8zjZwHceRSI4NCxdFzB4zpMHJ_MQcY700Pbvglw5g
Block: Multibase
Input: (bytes)
ED 01 2E 6F CC E3 67 01 DC 79 14 88 E0 D0 B1 74 5C C1 E3 3A 4C 1C 9F CC 41 C6 3B D3 43 DB BE 09 70 E6
Input: (encoding)
z-base-32
Output: (text)
h7wy1h56chpuodzd3n1rqbwftqtqcda34joqj9unbaa77go65zarzb3o
Note
This demonstrates that the above
z6Mkha…
,u7QEub…
, andh7wy1h…
strings are functionally identical as an Ed25519 public key to any system that can parse Multibase + Multicodec strings.Describe a concrete use case
Multibase and Multicodec encoding are used increasingly frequently, particularly in distributed computing, as they are self describing in their encodings (making them very future compatible). (They are used for the content addressed IDs of IPFS, the format of the
did:key
distributed ID method, and many other spaces — Multibase is also an active IETF draft).I regulary interact with strings that could be Multibase + Multicodec encoded, but find myself having to manually decode them to (a) determine if they're valid/really are Multibase, (b) to extract the "lookup byte" and manually check what the string represents, and/or (c) to re-encode them with a different base. It would be immensely useful if cipher editor allowed me to break apart and rebuild a multicodec with a few clicks!
Implementation
There is an official Multiformat JS library that covers all the encoding/decoding needed: multiformats/js-multiformats
The text was updated successfully, but these errors were encountered: