Skip to content

Commit

Permalink
fix: update the multicodec table
Browse files Browse the repository at this point in the history
The upstream table changed its formatting, hence also the script needed
some changes. The ordering of the codecs within a group is now according
to the codec code value.

Closes #40.
  • Loading branch information
vmx committed Mar 19, 2019
1 parent 413542b commit 2e5367f
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 153 deletions.
90 changes: 51 additions & 39 deletions src/base-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,27 @@
/* eslint-disable dot-notation */
'use strict'

// miscellaneous
exports['raw'] = Buffer.from('55', 'hex')

// serialization formats
exports['cbor'] = Buffer.from('51', 'hex')
// serialization
exports['protobuf'] = Buffer.from('50', 'hex')
exports['cbor'] = Buffer.from('51', 'hex')
exports['rlp'] = Buffer.from('60', 'hex')
exports['bencode'] = Buffer.from('63', 'hex')

// multiformats
// multiformat
exports['multicodec'] = Buffer.from('30', 'hex')
exports['multihash'] = Buffer.from('31', 'hex')
exports['multiaddr'] = Buffer.from('32', 'hex')
exports['multibase'] = Buffer.from('33', 'hex')

// multihashes
// multihash
exports['identity'] = Buffer.from('00', 'hex')
exports['md4'] = Buffer.from('d4', 'hex')
exports['md5'] = Buffer.from('d5', 'hex')
exports['sha1'] = Buffer.from('11', 'hex')
exports['sha2-256'] = Buffer.from('12', 'hex')
exports['sha2-512'] = Buffer.from('13', 'hex')
exports['dbl-sha2-256'] = Buffer.from('56', 'hex')
exports['sha3-224'] = Buffer.from('17', 'hex')
exports['sha3-256'] = Buffer.from('16', 'hex')
exports['sha3-384'] = Buffer.from('15', 'hex')
exports['sha3-512'] = Buffer.from('14', 'hex')
exports['sha3-384'] = Buffer.from('15', 'hex')
exports['sha3-256'] = Buffer.from('16', 'hex')
exports['sha3-224'] = Buffer.from('17', 'hex')
exports['shake-128'] = Buffer.from('18', 'hex')
exports['shake-256'] = Buffer.from('19', 'hex')
exports['keccak-224'] = Buffer.from('1a', 'hex')
Expand All @@ -38,6 +32,10 @@ exports['keccak-384'] = Buffer.from('1c', 'hex')
exports['keccak-512'] = Buffer.from('1d', 'hex')
exports['murmur3-128'] = Buffer.from('22', 'hex')
exports['murmur3-32'] = Buffer.from('23', 'hex')
exports['dbl-sha2-256'] = Buffer.from('56', 'hex')
exports['md4'] = Buffer.from('d4', 'hex')
exports['md5'] = Buffer.from('d5', 'hex')
exports['bmt'] = Buffer.from('d6', 'hex')
exports['x11'] = Buffer.from('1100', 'hex')
exports['blake2b-8'] = Buffer.from('b201', 'hex')
exports['blake2b-16'] = Buffer.from('b202', 'hex')
Expand Down Expand Up @@ -360,42 +358,47 @@ exports['skein1024-1008'] = Buffer.from('b3de', 'hex')
exports['skein1024-1016'] = Buffer.from('b3df', 'hex')
exports['skein1024-1024'] = Buffer.from('b3e0', 'hex')

// multiaddrs
// multiaddr
exports['ip4'] = Buffer.from('04', 'hex')
exports['ip6'] = Buffer.from('29', 'hex')
exports['ip6zone'] = Buffer.from('2a', 'hex')
exports['tcp'] = Buffer.from('06', 'hex')
exports['udp'] = Buffer.from('0111', 'hex')
exports['dccp'] = Buffer.from('21', 'hex')
exports['ip6'] = Buffer.from('29', 'hex')
exports['ip6zone'] = Buffer.from('2a', 'hex')
exports['dns'] = Buffer.from('35', 'hex')
exports['dns4'] = Buffer.from('36', 'hex')
exports['dns6'] = Buffer.from('37', 'hex')
exports['dnsaddr'] = Buffer.from('38', 'hex')
exports['sctp'] = Buffer.from('84', 'hex')
exports['udp'] = Buffer.from('0111', 'hex')
exports['p2p-webrtc-star'] = Buffer.from('0113', 'hex')
exports['p2p-webrtc-direct'] = Buffer.from('0114', 'hex')
exports['p2p-stardust'] = Buffer.from('0115', 'hex')
exports['p2p-circuit'] = Buffer.from('0122', 'hex')
exports['udt'] = Buffer.from('012d', 'hex')
exports['utp'] = Buffer.from('012e', 'hex')
exports['unix'] = Buffer.from('0190', 'hex')
exports['p2p'] = Buffer.from('01a5', 'hex')
exports['ipfs'] = Buffer.from('01a5', 'hex')
exports['http'] = Buffer.from('01e0', 'hex')
exports['https'] = Buffer.from('01bb', 'hex')
exports['quic'] = Buffer.from('01cc', 'hex')
exports['ws'] = Buffer.from('01dd', 'hex')
exports['wss'] = Buffer.from('01de', 'hex')
exports['onion'] = Buffer.from('01bc', 'hex')
exports['onion3'] = Buffer.from('01bd', 'hex')
exports['garlic64'] = Buffer.from('01be', 'hex')
exports['p2p-circuit'] = Buffer.from('0122', 'hex')
exports['dns'] = Buffer.from('35', 'hex')
exports['dns4'] = Buffer.from('36', 'hex')
exports['dns6'] = Buffer.from('37', 'hex')
exports['dnsaddr'] = Buffer.from('38', 'hex')
exports['quic'] = Buffer.from('01cc', 'hex')
exports['ws'] = Buffer.from('01dd', 'hex')
exports['wss'] = Buffer.from('01de', 'hex')
exports['p2p-websocket-star'] = Buffer.from('01df', 'hex')
exports['p2p-stardust'] = Buffer.from('0115', 'hex')
exports['p2p-webrtc-star'] = Buffer.from('0113', 'hex')
exports['p2p-webrtc-direct'] = Buffer.from('0114', 'hex')
exports['unix'] = Buffer.from('0190', 'hex')
exports['http'] = Buffer.from('01e0', 'hex')

// IPLD formats
// ipld
exports['raw'] = Buffer.from('55', 'hex')
exports['dag-pb'] = Buffer.from('70', 'hex')
exports['dag-cbor'] = Buffer.from('71', 'hex')
exports['dag-json'] = Buffer.from('0129', 'hex')
exports['git-raw'] = Buffer.from('78', 'hex')
exports['torrent-info'] = Buffer.from('7b', 'hex')
exports['torrent-file'] = Buffer.from('7c', 'hex')
exports['leofcoin-block'] = Buffer.from('81', 'hex')
exports['leofcoin-tx'] = Buffer.from('82', 'hex')
exports['leofcoin-pr'] = Buffer.from('83', 'hex')
exports['eth-block'] = Buffer.from('90', 'hex')
exports['eth-block-list'] = Buffer.from('91', 'hex')
exports['eth-tx-trie'] = Buffer.from('92', 'hex')
Expand All @@ -415,14 +418,23 @@ exports['decred-block'] = Buffer.from('e0', 'hex')
exports['decred-tx'] = Buffer.from('e1', 'hex')
exports['dash-block'] = Buffer.from('f0', 'hex')
exports['dash-tx'] = Buffer.from('f1', 'hex')
exports['leofcoin-block'] = Buffer.from('81', 'hex')
exports['leofcoin-tx'] = Buffer.from('82', 'hex')
exports['leofcoin-pr'] = Buffer.from('83', 'hex')
exports['torrent-info'] = Buffer.from('7b', 'hex')
exports['torrent-file'] = Buffer.from('7c', 'hex')
exports['ed25519-pub'] = Buffer.from('ed', 'hex')
exports['swarm-manifest'] = Buffer.from('fa', 'hex')
exports['swarm-feed'] = Buffer.from('fb', 'hex')
exports['dag-json'] = Buffer.from('0129', 'hex')

// Content Namespaces
// namespace
exports['path'] = Buffer.from('2f', 'hex')
exports['ipld-ns'] = Buffer.from('e2', 'hex')
exports['ipfs-ns'] = Buffer.from('e3', 'hex')
exports['swarm-ns'] = Buffer.from('e4', 'hex')

// key
exports['ed25519-pub'] = Buffer.from('ed', 'hex')

// holochain
exports['holochain-adr-v0'] = Buffer.from('807124', 'hex')
exports['holochain-adr-v1'] = Buffer.from('817124', 'hex')
exports['holochain-key-v0'] = Buffer.from('947124', 'hex')
exports['holochain-key-v1'] = Buffer.from('957124', 'hex')
exports['holochain-sig-v0'] = Buffer.from('a27124', 'hex')
exports['holochain-sig-v1'] = Buffer.from('a37124', 'hex')
92 changes: 52 additions & 40 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,27 @@
'use strict'
module.exports = Object.freeze({

// miscellaneous,
RAW: 0x55,

// serialization formats,
CBOR: 0x51,
// serialization
PROTOBUF: 0x50,
CBOR: 0x51,
RLP: 0x60,
BENCODE: 0x63,

// multiformats,
// multiformat
MULTICODEC: 0x30,
MULTIHASH: 0x31,
MULTIADDR: 0x32,
MULTIBASE: 0x33,

// multihashes,
// multihash
IDENTITY: 0x00,
MD4: 0xd4,
MD5: 0xd5,
SHA1: 0x11,
SHA2_256: 0x12,
SHA2_512: 0x13,
DBL_SHA2_256: 0x56,
SHA3_224: 0x17,
SHA3_256: 0x16,
SHA3_384: 0x15,
SHA3_512: 0x14,
SHA3_384: 0x15,
SHA3_256: 0x16,
SHA3_224: 0x17,
SHAKE_128: 0x18,
SHAKE_256: 0x19,
KECCAK_224: 0x1a,
Expand All @@ -39,6 +33,10 @@ module.exports = Object.freeze({
KECCAK_512: 0x1d,
MURMUR3_128: 0x22,
MURMUR3_32: 0x23,
DBL_SHA2_256: 0x56,
MD4: 0xd4,
MD5: 0xd5,
BMT: 0xd6,
X11: 0x1100,
BLAKE2B_8: 0xb201,
BLAKE2B_16: 0xb202,
Expand Down Expand Up @@ -361,42 +359,47 @@ module.exports = Object.freeze({
SKEIN1024_1016: 0xb3df,
SKEIN1024_1024: 0xb3e0,

// multiaddrs,
// multiaddr
IP4: 0x04,
IP6: 0x29,
IP6ZONE: 0x2a,
TCP: 0x06,
UDP: 0x0111,
DCCP: 0x21,
IP6: 0x29,
IP6ZONE: 0x2a,
DNS: 0x35,
DNS4: 0x36,
DNS6: 0x37,
DNSADDR: 0x38,
SCTP: 0x84,
UDP: 0x0111,
P2P_WEBRTC_STAR: 0x0113,
P2P_WEBRTC_DIRECT: 0x0114,
P2P_STARDUST: 0x0115,
P2P_CIRCUIT: 0x0122,
UDT: 0x012d,
UTP: 0x012e,
UNIX: 0x0190,
P2P: 0x01a5,
IPFS: 0x01a5,
HTTP: 0x01e0,
HTTPS: 0x01bb,
QUIC: 0x01cc,
WS: 0x01dd,
WSS: 0x01de,
ONION: 0x01bc,
ONION3: 0x01bd,
GARLIC64: 0x01be,
P2P_CIRCUIT: 0x0122,
DNS: 0x35,
DNS4: 0x36,
DNS6: 0x37,
DNSADDR: 0x38,
QUIC: 0x01cc,
WS: 0x01dd,
WSS: 0x01de,
P2P_WEBSOCKET_STAR: 0x01df,
P2P_STARDUST: 0x0115,
P2P_WEBRTC_STAR: 0x0113,
P2P_WEBRTC_DIRECT: 0x0114,
UNIX: 0x0190,
HTTP: 0x01e0,

// IPLD formats,
// ipld
RAW: 0x55,
DAG_PB: 0x70,
DAG_CBOR: 0x71,
DAG_JSON: 0x0129,
GIT_RAW: 0x78,
TORRENT_INFO: 0x7b,
TORRENT_FILE: 0x7c,
LEOFCOIN_BLOCK: 0x81,
LEOFCOIN_TX: 0x82,
LEOFCOIN_PR: 0x83,
ETH_BLOCK: 0x90,
ETH_BLOCK_LIST: 0x91,
ETH_TX_TRIE: 0x92,
Expand All @@ -416,15 +419,24 @@ module.exports = Object.freeze({
DECRED_TX: 0xe1,
DASH_BLOCK: 0xf0,
DASH_TX: 0xf1,
LEOFCOIN_BLOCK: 0x81,
LEOFCOIN_TX: 0x82,
LEOFCOIN_PR: 0x83,
TORRENT_INFO: 0x7b,
TORRENT_FILE: 0x7c,
ED25519_PUB: 0xed,
SWARM_MANIFEST: 0xfa,
SWARM_FEED: 0xfb,
DAG_JSON: 0x0129,

// Content Namespaces,
// namespace
PATH: 0x2f,
IPLD_NS: 0xe2,
IPFS_NS: 0xe3,
SWARM_NS: 0xe4
SWARM_NS: 0xe4,

// key
ED25519_PUB: 0xed,

// holochain
HOLOCHAIN_ADR_V0: 0x807124,
HOLOCHAIN_ADR_V1: 0x817124,
HOLOCHAIN_KEY_V0: 0x947124,
HOLOCHAIN_KEY_V1: 0x957124,
HOLOCHAIN_SIG_V0: 0xa27124,
HOLOCHAIN_SIG_V1: 0xa37124
})
Loading

0 comments on commit 2e5367f

Please sign in to comment.