├── content
├── _index.md
├── index.md
├── multiaddr.md
└── multihash.md
├── layouts
├── robots.txt
├── shortcodes
│ ├── multiformat.html
│ ├── multiaddr.html
│ └── multihash.html
├── partials
│ ├── header.html
│ └── footer.html
├── _default
│ └── single.html
└── less
│ └── main.less
├── static
├── favicon.ico
├── apple-icon.png
├── favicon-16x16.png
├── favicon-32x32.png
├── favicon-96x96.png
├── ms-icon-144x144.png
├── ms-icon-150x150.png
├── ms-icon-310x310.png
├── ms-icon-70x70.png
├── projects
│ ├── ipfs.png
│ └── libp2p.png
├── apple-icon-57x57.png
├── apple-icon-60x60.png
├── apple-icon-72x72.png
├── apple-icon-76x76.png
├── android-icon-144x144.png
├── android-icon-192x192.png
├── android-icon-36x36.png
├── android-icon-48x48.png
├── android-icon-72x72.png
├── android-icon-96x96.png
├── apple-icon-114x114.png
├── apple-icon-120x120.png
├── apple-icon-144x144.png
├── apple-icon-152x152.png
├── apple-icon-180x180.png
├── protocol-labs-logo.png
├── apple-icon-precomposed.png
├── fonts
│ ├── -L14Jk06m6pUHB-5mXQQnYX0hVgzZQUfRDuZrPvH3D8.woff2
│ ├── 0eC6fl06luXEYWpBSJvXCIX0hVgzZQUfRDuZrPvH3D8.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at14sYYdJg5dU2qzJEVSuta0.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at1BW26QxpSj-_ZKm_xT4hWw.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at4gp9Q8gbYrhqGlRav_IXfk.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at6E8kM4xWR1_1bYURRojRGc.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at9DiNsR5a-9Oe_Ivpu8XWlY.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0at_ZraR2Tg8w2lzm7kLNL0-w.woff2
│ ├── 7m8l7TlFO-S3VkhHuR0atwt_Rm691LTebKfY2ZkKSmI.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTQ7aC6SjiAOpAWOKfJDfVRY.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTRampu5_7CjHW5spxoeN3Vs.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTRdwxCXfZpKo5kWAx_74bHs.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTYjoYw3YTyktCCer_ilOlhE.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTZ6vnaPZw6nYDxM4SVEMFKg.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTfgrLsWo7Jk1KvZser0olKY.woff2
│ ├── DXI1ORHCpsQm3Vp6mXoaTfy1_HTwRwgtl1cPga3Fy3Y.woff2
│ ├── Fl4y0QdOxyyTHEGMXX8kcYX0hVgzZQUfRDuZrPvH3D8.woff2
│ ├── Hgo13k-tfSpn0qi1SFdUfZBw1xU1rKptJj_0jans920.woff2
│ ├── I3S1wsgSg9YCurV6PUkTOYX0hVgzZQUfRDuZrPvH3D8.woff2
│ ├── NYDWBdD4gIq26G5XYbHsFIX0hVgzZQUfRDuZrPvH3D8.woff2
│ ├── Pru33qjShpZSmG3z6VYwnYX0hVgzZQUfRDuZrPvH3D8.woff2
│ └── fonts.css
├── browserconfig.xml
├── manifest.json
└── logo.svg
├── .gitignore
├── .github
└── workflows
│ ├── stale.yml
│ └── generated-pr.yml
├── hugo.toml
├── package.json
├── LICENSE
├── list-multihashes.js
├── Makefile
└── README.md
/content/_index.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/layouts/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 |
3 | Sitemap: sitemap.xml
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/favicon.ico
--------------------------------------------------------------------------------
/static/apple-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon.png
--------------------------------------------------------------------------------
/static/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/favicon-16x16.png
--------------------------------------------------------------------------------
/static/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/favicon-32x32.png
--------------------------------------------------------------------------------
/static/favicon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/favicon-96x96.png
--------------------------------------------------------------------------------
/static/ms-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/ms-icon-144x144.png
--------------------------------------------------------------------------------
/static/ms-icon-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/ms-icon-150x150.png
--------------------------------------------------------------------------------
/static/ms-icon-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/ms-icon-310x310.png
--------------------------------------------------------------------------------
/static/ms-icon-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/ms-icon-70x70.png
--------------------------------------------------------------------------------
/static/projects/ipfs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/projects/ipfs.png
--------------------------------------------------------------------------------
/static/projects/libp2p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/projects/libp2p.png
--------------------------------------------------------------------------------
/static/apple-icon-57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-57x57.png
--------------------------------------------------------------------------------
/static/apple-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-60x60.png
--------------------------------------------------------------------------------
/static/apple-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-72x72.png
--------------------------------------------------------------------------------
/static/apple-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-76x76.png
--------------------------------------------------------------------------------
/static/android-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-144x144.png
--------------------------------------------------------------------------------
/static/android-icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-192x192.png
--------------------------------------------------------------------------------
/static/android-icon-36x36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-36x36.png
--------------------------------------------------------------------------------
/static/android-icon-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-48x48.png
--------------------------------------------------------------------------------
/static/android-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-72x72.png
--------------------------------------------------------------------------------
/static/android-icon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/android-icon-96x96.png
--------------------------------------------------------------------------------
/static/apple-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-114x114.png
--------------------------------------------------------------------------------
/static/apple-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-120x120.png
--------------------------------------------------------------------------------
/static/apple-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-144x144.png
--------------------------------------------------------------------------------
/static/apple-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-152x152.png
--------------------------------------------------------------------------------
/static/apple-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-180x180.png
--------------------------------------------------------------------------------
/static/protocol-labs-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/protocol-labs-logo.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | public
2 | node_modules
3 | package-lock.json
4 | static/css
5 | auth.token
6 | bin
7 | .hugo_build.lock
8 |
--------------------------------------------------------------------------------
/static/apple-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/apple-icon-precomposed.png
--------------------------------------------------------------------------------
/static/fonts/-L14Jk06m6pUHB-5mXQQnYX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/-L14Jk06m6pUHB-5mXQQnYX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/fonts/0eC6fl06luXEYWpBSJvXCIX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/0eC6fl06luXEYWpBSJvXCIX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at14sYYdJg5dU2qzJEVSuta0.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at14sYYdJg5dU2qzJEVSuta0.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at1BW26QxpSj-_ZKm_xT4hWw.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at1BW26QxpSj-_ZKm_xT4hWw.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at4gp9Q8gbYrhqGlRav_IXfk.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at4gp9Q8gbYrhqGlRav_IXfk.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at6E8kM4xWR1_1bYURRojRGc.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at6E8kM4xWR1_1bYURRojRGc.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at9DiNsR5a-9Oe_Ivpu8XWlY.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at9DiNsR5a-9Oe_Ivpu8XWlY.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0at_ZraR2Tg8w2lzm7kLNL0-w.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0at_ZraR2Tg8w2lzm7kLNL0-w.woff2
--------------------------------------------------------------------------------
/static/fonts/7m8l7TlFO-S3VkhHuR0atwt_Rm691LTebKfY2ZkKSmI.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/7m8l7TlFO-S3VkhHuR0atwt_Rm691LTebKfY2ZkKSmI.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTQ7aC6SjiAOpAWOKfJDfVRY.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTQ7aC6SjiAOpAWOKfJDfVRY.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTRampu5_7CjHW5spxoeN3Vs.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTRampu5_7CjHW5spxoeN3Vs.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTRdwxCXfZpKo5kWAx_74bHs.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTRdwxCXfZpKo5kWAx_74bHs.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTYjoYw3YTyktCCer_ilOlhE.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTYjoYw3YTyktCCer_ilOlhE.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTZ6vnaPZw6nYDxM4SVEMFKg.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTZ6vnaPZw6nYDxM4SVEMFKg.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTfgrLsWo7Jk1KvZser0olKY.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTfgrLsWo7Jk1KvZser0olKY.woff2
--------------------------------------------------------------------------------
/static/fonts/DXI1ORHCpsQm3Vp6mXoaTfy1_HTwRwgtl1cPga3Fy3Y.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/DXI1ORHCpsQm3Vp6mXoaTfy1_HTwRwgtl1cPga3Fy3Y.woff2
--------------------------------------------------------------------------------
/static/fonts/Fl4y0QdOxyyTHEGMXX8kcYX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/Fl4y0QdOxyyTHEGMXX8kcYX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/fonts/Hgo13k-tfSpn0qi1SFdUfZBw1xU1rKptJj_0jans920.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/Hgo13k-tfSpn0qi1SFdUfZBw1xU1rKptJj_0jans920.woff2
--------------------------------------------------------------------------------
/static/fonts/I3S1wsgSg9YCurV6PUkTOYX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/I3S1wsgSg9YCurV6PUkTOYX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/fonts/NYDWBdD4gIq26G5XYbHsFIX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/NYDWBdD4gIq26G5XYbHsFIX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/fonts/Pru33qjShpZSmG3z6VYwnYX0hVgzZQUfRDuZrPvH3D8.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/multiformats/website/HEAD/static/fonts/Pru33qjShpZSmG3z6VYwnYX0hVgzZQUfRDuZrPvH3D8.woff2
--------------------------------------------------------------------------------
/static/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 | #ffffff
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | name: Close Stale Issues
2 |
3 | on:
4 | schedule:
5 | - cron: '0 0 * * *'
6 | workflow_dispatch:
7 |
8 | permissions:
9 | issues: write
10 | pull-requests: write
11 |
12 | jobs:
13 | stale:
14 | uses: ipdxco/unified-github-workflows/.github/workflows/reusable-stale-issue.yml@v1
15 |
--------------------------------------------------------------------------------
/.github/workflows/generated-pr.yml:
--------------------------------------------------------------------------------
1 | name: Close Generated PRs
2 |
3 | on:
4 | schedule:
5 | - cron: '0 0 * * *'
6 | workflow_dispatch:
7 |
8 | permissions:
9 | issues: write
10 | pull-requests: write
11 |
12 | jobs:
13 | stale:
14 | uses: ipdxco/unified-github-workflows/.github/workflows/reusable-generated-pr.yml@v1
15 |
--------------------------------------------------------------------------------
/hugo.toml:
--------------------------------------------------------------------------------
1 | disableKinds = ['home', 'taxonomy', 'term']
2 | enableRobotsTXT = true
3 | languageCode = "en-us"
4 | title = "Multiformats"
5 |
6 | [markup.goldmark.renderer]
7 | unsafe = true
8 |
9 | [params]
10 | description = "A collection of protocols for future-proofing systems, today."
11 | specifications = "https://github.com/multiformats/specs"
12 |
13 | author = "Protocol Labs"
14 | github = "https://github.com/multiformats/multiformats"
15 | name = "Multiformats"
--------------------------------------------------------------------------------
/layouts/shortcodes/multiformat.html:
--------------------------------------------------------------------------------
1 | {{ $syntax := .Get "syntax" }}
2 | {{ $labels := .Get "labels" }}
3 |
4 |
--------------------------------------------------------------------------------
/layouts/shortcodes/multiaddr.html:
--------------------------------------------------------------------------------
1 |
2 | {{ $syntax := .Get "syntax" }}
3 | {{ $labels := .Get "labels" }}
4 |
5 |
6 |
7 |
{{ .Get "fnCode" }}{{ .Get "lengthCode" }}{{ .Get "digest" }}
8 |
9 |
10 |
Hashing function: {{ .Get "fnName" }} (code: {{ .Get "fnCode" }})
11 |
Length: {{ .Get "length" }} (encoding: {{ .Get "lengthCode" }})
12 |
Digest: {{ .Get "digest" }}
13 |
14 |
15 |
--------------------------------------------------------------------------------
/layouts/shortcodes/multihash.html:
--------------------------------------------------------------------------------
1 |
2 | {{ $syntax := .Get "syntax" }}
3 | {{ $labels := .Get "labels" }}
4 |
5 |
6 |
7 |
8 | {{ .Get "fnCodeVarint" }}{{ .Get "lengthCode" }}{{ .Get "digest" }}
9 |
10 |
11 |
Hashing function encoded as varint: {{ .Get "fnName" }} (code in hex: 0x{{ .Get "fnCode" }})
12 |
Length: {{ .Get "length" }} (in hex: 0x{{ .Get "lengthCode" }})
13 |
Digest: {{ .Get "digest" }}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "multiformats-website",
3 | "version": "1.0.0",
4 | "description": "Multiformats website",
5 | "main": "list-multihashes.js",
6 | "dependencies": {
7 | "multihashes": "^0.4.2",
8 | "multihashing": "^0.3.0"
9 | },
10 | "devDependencies": {
11 | "clean-css": "^5.3.2",
12 | "hugo-bin": "^0.111.0",
13 | "less": "^4.2.0",
14 | "nodemon": "^3.0.1"
15 | },
16 | "scripts": {
17 | "test": "echo \"Error: no test specified\" && exit 1"
18 | },
19 | "repository": {
20 | "type": "git",
21 | "url": "git+https://github.com/multiformats/website.git"
22 | },
23 | "author": "",
24 | "license": "MIT",
25 | "bugs": {
26 | "url": "https://github.com/multiformats/website/issues"
27 | },
28 | "homepage": "https://github.com/multiformats/website#readme"
29 | }
30 |
--------------------------------------------------------------------------------
/static/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "App",
3 | "icons": [
4 | {
5 | "src": "\/android-icon-36x36.png",
6 | "sizes": "36x36",
7 | "type": "image\/png",
8 | "density": "0.75"
9 | },
10 | {
11 | "src": "\/android-icon-48x48.png",
12 | "sizes": "48x48",
13 | "type": "image\/png",
14 | "density": "1.0"
15 | },
16 | {
17 | "src": "\/android-icon-72x72.png",
18 | "sizes": "72x72",
19 | "type": "image\/png",
20 | "density": "1.5"
21 | },
22 | {
23 | "src": "\/android-icon-96x96.png",
24 | "sizes": "96x96",
25 | "type": "image\/png",
26 | "density": "2.0"
27 | },
28 | {
29 | "src": "\/android-icon-144x144.png",
30 | "sizes": "144x144",
31 | "type": "image\/png",
32 | "density": "3.0"
33 | },
34 | {
35 | "src": "\/android-icon-192x192.png",
36 | "sizes": "192x192",
37 | "type": "image\/png",
38 | "density": "4.0"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/layouts/partials/header.html:
--------------------------------------------------------------------------------
1 | {{ $isHomePage := eq .Title .Site.Title }}
2 |
--------------------------------------------------------------------------------
/layouts/partials/footer.html:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Protocol Labs Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/list-multihashes.js:
--------------------------------------------------------------------------------
1 | const multihash = require('multihashes')
2 | const multihashing = require('multihashing')
3 | const varint = require('varint')
4 |
5 | const buf = Buffer.from('Merkle–Damgård', 'utf8')
6 |
7 | const funcs = [
8 | ['sha1', 160],
9 | ['sha2-256', 256],
10 | ['sha2-512', 256],
11 | ['sha2-512', 512],
12 | ['blake2b-512', 512],
13 | ['blake2b-256', 256],
14 | ['blake2s-256', 256],
15 | ['blake2s-128', 128],
16 | ]
17 |
18 | for (const i in funcs) {
19 | const encoded = multihashing(buf, funcs[i][0], funcs[i][1] / 8)
20 | const decoded = multihash.decode(encoded)
21 |
22 | // Decode start of the hash to get the number of bytes the codec takes
23 | varint.decode(encoded)
24 | const encodedCodeSize = varint.decode.bytes
25 | const fnCodeVarint = encoded.slice(0, encodedCodeSize)
26 |
27 | console.log('### ' + decoded.name + ' - ' + (decoded.length * 8) + ' bits')
28 | console.log('')
29 | console.log('{{% multihash')
30 | console.log(' fnName="' + decoded.name + '"')
31 | console.log(' fnCode="' + decoded.code.toString(16) + '"')
32 | console.log(' fnCodeVarint="' + fnCodeVarint.toString('hex') + '"')
33 | console.log(' length="' + decoded.length + '"')
34 | console.log(' lengthCode="' + decoded.length.toString(16) + '"')
35 | console.log(' digest="' + decoded.digest.toString('hex') + '"')
36 | console.log(' multihash="' + encoded.toString('hex') + '"')
37 | console.log('%}}')
38 | console.log('')
39 | }
40 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | DOMAIN="multiformats.io"
2 | IPFSLOCAL="http://localhost:8080/ipfs/"
3 | IPFSGATEWAY="https://ipfs.io/ipfs/"
4 | OUTPUTDIR=public
5 | NPMBIN=./node_modules/.bin
6 |
7 | ifeq ($(DEBUG), true)
8 | PREPEND=
9 | APPEND=
10 | else
11 | PREPEND=@
12 | APPEND=1>/dev/null
13 | endif
14 |
15 | build: install lint css
16 | $(PREPEND)$(NPMBIN)/hugo && \
17 | echo "" && \
18 | echo "Site built out to ./$(OUTPUTDIR) dir"
19 |
20 | help:
21 | @echo 'Makefile for a multiformats.io, a hugo built static site. '
22 | @echo ' '
23 | @echo 'Usage: '
24 | @echo ' make Build the optimised site to ./$(OUTPUTDIR) '
25 | @echo ' make serve Preview the production ready site at http://localhost:1313 '
26 | @echo ' make lint Check your CSS is ok '
27 | @echo ' make css Compile the *.css to ./static/css '
28 | @echo ' make dev Start a hot-reloding dev server on http://localhost:1313 '
29 | @echo ' make clean remove the generated files '
30 | @echo ' '
31 | @echo ' DEBUG=true make [command] for increased verbosity '
32 |
33 | clean:
34 | $(PREPEND)[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) && \
35 | [ ! -d static/css ] || rm -rf static/css/*.css
36 |
37 | node_modules:
38 | $(PREPEND)npm i $(APPEND)
39 |
40 | install: node_modules
41 | $(PREPEND)[ -d static/css ] || mkdir -p static/css
42 |
43 | lint: install
44 | $(PREPEND)$(NPMBIN)/lessc --lint layouts/less/*
45 |
46 | css: install
47 | $(PREPEND)$(NPMBIN)/lessc --clean-css layouts/less/main.less static/css/main.css $(APPEND)
48 |
49 | serve: install lint css
50 | $(PREPEND)$(NPMBIN)/hugo server
51 |
52 | dev: install css
53 | $(PREPEND)( \
54 | $(NPMBIN)/nodemon --watch layouts/css --exec "$(NPMBIN)/lessc --clean-css layouts/less/main.less static/css/main.css" & \
55 | $(NPMBIN)/hugo server -w \
56 | )
57 |
58 | .PHONY: build help install lint css serve clean
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The Multiformats website
2 |
3 | [](http://ipn.io)
4 | [](https://github.com/multiformats/multiformats)
5 | [](https://webchat.freenode.net/?channels=%23ipfs)
6 | [](https://github.com/RichardLitt/standard-readme)
7 |
8 | > Official website for Multiformats http://multiformats.io
9 |
10 | This repository contains the source code for the Multiformats website available at http://multiformats.io
11 |
12 | This project builds out a static site to explain Multiformats, ready for deployment on ipfs. It uses `hugo` to glue the html together. It provides an informative, public-facing website. The most important things are the words, concepts and links it presents.
13 |
14 | ## Install
15 |
16 | ```sh
17 | git clone https://github.com/multiformats/website.git
18 | ```
19 |
20 | ## Usage
21 |
22 | To deploy the site multiformats.io, run:
23 |
24 | ```sh
25 | # Build out the optimised site to ./public, where you can check it locally.
26 | make
27 |
28 | ```
29 |
30 | The following commands are available:
31 |
32 | ### `make`
33 |
34 | Build the optimised site to the `./public` dir
35 |
36 | ### `make serve`
37 |
38 | Preview the production ready site at http://localhost:1313
39 |
40 | ### `make dev`
41 |
42 | Start a hot-reloading dev server on http://localhost:1313
43 |
44 | ## Deploying the site
45 |
46 | If you want to deploy the site to IPFS locally, you can run `ipfs add --cid-version 1 -r -q public | tail -n1` add the website to your local IPFS instance and then access it at your local IPFS gateway URL, e.g. http://127.0.0.1:8080/ipfs/${CID}
47 |
48 | The production site is deployed to https://multiformats.io using https://fleek.co/ when new changes are merged to the repo at https://github.com/multiformats/website.
49 |
50 | ---
51 |
52 | See the `Makefile` for the full list or run `make help` in the project root. You can pass the env var `DEBUG=true` to increase the verbosity of your chosen command.
53 |
54 | ## Dependencies
55 |
56 | * `Node.js` and `npm` for build tools
57 |
58 | ### Optional Dependencies
59 |
60 | * `ipfs` to deploy changes to ipfs locally - optional
61 |
62 | ## Maintainers
63 |
64 | [@victorbjelkholm](https://github.com/victorbjelkholm)
65 |
66 | ## Contribute
67 |
68 | Please do! Check out the [issues](https://github.com/multiformats/website/issues), or open a PR!
69 |
70 | Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
71 |
72 | Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
73 |
74 | ## License
75 |
76 | [MIT](LICENSE) © 2016 Protocol Labs Inc.
--------------------------------------------------------------------------------
/layouts/_default/single.html:
--------------------------------------------------------------------------------
1 | {{ $isHomePage := eq .Site.Title .Page.Title }}
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | {{ if not $isHomePage }}{{ .Page.Title }} | {{ end }}{{ .Site.Title }}
46 |
47 |
48 |
49 |
50 |
51 | {{ partial "header.html" . }}
52 |
53 |
54 | {{ .Content }}
55 |
56 |
57 | {{ partial "footer.html" . }}
58 |
59 |
66 |
67 |
--------------------------------------------------------------------------------
/static/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
97 |
98 |
99 |
101 |
102 |
104 |
106 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/content/index.md:
--------------------------------------------------------------------------------
1 | +++
2 | base_url = "/"
3 | title = "Multiformats"
4 | stars = "multiformats/multiformats"
5 | +++
6 | > ## Self-describing values for Future-proofing
7 |
8 | Every choice in computing has a tradeoff. This includes formats, algorithms, encodings, and so on. And even with a great deal of planning, decisions may lead to breaking changes down the road, or to solutions which are no longer optimal. Allowing systems to evolve and grow is important.
9 |
10 | - [What are Multiformats?](#what-are-multiformats)
11 | - [Multiformat protocols](#multiformat-protocols)
12 | - [Projects using Multiformats](#projects-using-multiformats)
13 | - [Contribute & Community](#contribute--community)
14 |
15 | ## What are Multiformats?
16 |
17 | The Multiformats Project is a collection of protocols which aim to future-proof systems, today. They do this mainly by enhancing format values with self-description. This allows interoperability, protocol agility, and helps us avoid lock in.
18 |
19 | The self-describing aspects of the protocols have a few stipulations:
20 |
21 | - They MUST be _in-band_ (with the value); not _out-of-band_ (in context).
22 | - They MUST avoid _lock-in_ and promote _extensibility_.
23 | - They MUST be compact and have a _binary-packed_ representation.
24 | - They MUST have a _human-readable_ representation.
25 |
26 |
27 | ## Multiformat protocols
28 |
29 | The Multiformats Project describes a series of protocols. Currently, the following protocols exist:
30 |
31 | - [multiaddr](./multiaddr) (WIP) - self-describing network addresses
32 | - [multibase](https://github.com/multiformats/multibase) (WIP) - self-describing base encodings
33 | - [multicodec](https://github.com/multiformats/multicodec) - self-describing serialization
34 | - [multihash](./multihash) - self-describing hashes
35 |
36 |
39 |
40 | Each of the projects has its list of implementations in various languages.
41 |
42 | Also, some protocols are deprecated or frozen:
43 |
44 | - [multigram](https://github.com/multiformats/multigram) (FROZEN) - self-describing packet network protocols
45 | - [multistream](https://github.com/multiformats/multistream) (DEPRECATED) - self-describing stream network protocols
46 |
47 | ### Project Status
48 |
49 | Several of the multiformats have stable specs and stable implementations. We're are working on the others. We prioritize their usage as soon as possible, as what they offer -- protocol interoperability and future-proofing -- has real-world consequences today.
50 |
51 | Towards that end, we are encouraging improvements to WIP protocols, and implementations of all. Please contribute to the projects on GitHub.
52 |
53 |
54 | ### A note on the word Multiformats
55 |
56 | Multiformats is the name for the organization, but it can also be used to refer to protocols; for instance, in the sentence "Use one of the multiformats". Formats is interchangeable with protocols, here. We try to capitalize Multiformats when it refers to the organization, on GitHub.
57 |
58 | ## Projects using Multiformats
59 |
60 | The Multiformats project began through [the IPFS Project](https://ipfs.io). It is used extensively in projects like
61 |
62 |
63 |
64 |
65 | IPFS
66 | - an open system to manage data without a central server.
67 |
68 |
69 | CIDs
70 | - a self-describing content-addressed identifier scheme for distributed systems, used to address files in IPFS and systems interoperable with it, as well as in other systems like IPLD, where it is the primary way of expressing links between documents.
71 |
72 |
73 |
74 | libp2p
75 | - a modular network library for peer-to-peer protocols.
76 |
77 |
78 |
79 | IPLD
80 | - a set of standards and implementations for creating decentralized data-structures that are universally addressable and linkable.
81 |
82 |
83 | (add yours here)
84 |
85 |
86 |
87 | ## Contribute & Community
88 |
89 | The Multiformats Project is an Open Source software project. It is built by a large community of contributors. Please join us on GitHub or Matrix to request features, file bugs, contribute code, improve documentation, and ask questions. We have a very open and welcoming community.
90 |
91 | - [GitHub Project](https://github.com/multiformats/multiformats)
92 | - [Website Repository](https://github.com/multiformats/website)
93 | - [Matrix chatroom](https://matrix.to/#/#multiformats:ipfs.io) (`#multiformats:ipfs.io`)
94 | - [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md)
95 | - [Contributing Guide](https://github.com/multiformats/multiformats/blob/master/contributing.md)
--------------------------------------------------------------------------------
/static/fonts/fonts.css:
--------------------------------------------------------------------------------
1 | /* cyrillic-ext */
2 | @font-face {
3 | font-family: 'Open Sans';
4 | font-style: normal;
5 | font-weight: 300;
6 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTQ7aC6SjiAOpAWOKfJDfVRY.woff2) format('woff2');
7 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
8 | }
9 | /* cyrillic */
10 | @font-face {
11 | font-family: 'Open Sans';
12 | font-style: normal;
13 | font-weight: 300;
14 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTRdwxCXfZpKo5kWAx_74bHs.woff2) format('woff2');
15 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
16 | }
17 | /* greek-ext */
18 | @font-face {
19 | font-family: 'Open Sans';
20 | font-style: normal;
21 | font-weight: 300;
22 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTZ6vnaPZw6nYDxM4SVEMFKg.woff2) format('woff2');
23 | unicode-range: U+1F00-1FFF;
24 | }
25 | /* greek */
26 | @font-face {
27 | font-family: 'Open Sans';
28 | font-style: normal;
29 | font-weight: 300;
30 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTfy1_HTwRwgtl1cPga3Fy3Y.woff2) format('woff2');
31 | unicode-range: U+0370-03FF;
32 | }
33 | /* vietnamese */
34 | @font-face {
35 | font-family: 'Open Sans';
36 | font-style: normal;
37 | font-weight: 300;
38 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTfgrLsWo7Jk1KvZser0olKY.woff2) format('woff2');
39 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
40 | }
41 | /* latin-ext */
42 | @font-face {
43 | font-family: 'Open Sans';
44 | font-style: normal;
45 | font-weight: 300;
46 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTYjoYw3YTyktCCer_ilOlhE.woff2) format('woff2');
47 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
48 | }
49 | /* latin */
50 | @font-face {
51 | font-family: 'Open Sans';
52 | font-style: normal;
53 | font-weight: 300;
54 | src: local('Open Sans Light'), local('OpenSans-Light'), url(DXI1ORHCpsQm3Vp6mXoaTRampu5_7CjHW5spxoeN3Vs.woff2) format('woff2');
55 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
56 | }
57 | /* cyrillic-ext */
58 | @font-face {
59 | font-family: 'Roboto';
60 | font-style: normal;
61 | font-weight: 300;
62 | src: local('Roboto Light'), local('Roboto-Light'), url(0eC6fl06luXEYWpBSJvXCIX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
63 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
64 | }
65 | /* cyrillic */
66 | @font-face {
67 | font-family: 'Roboto';
68 | font-style: normal;
69 | font-weight: 300;
70 | src: local('Roboto Light'), local('Roboto-Light'), url(Fl4y0QdOxyyTHEGMXX8kcYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
71 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
72 | }
73 | /* greek-ext */
74 | @font-face {
75 | font-family: 'Roboto';
76 | font-style: normal;
77 | font-weight: 300;
78 | src: local('Roboto Light'), local('Roboto-Light'), url(-L14Jk06m6pUHB-5mXQQnYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
79 | unicode-range: U+1F00-1FFF;
80 | }
81 | /* greek */
82 | @font-face {
83 | font-family: 'Roboto';
84 | font-style: normal;
85 | font-weight: 300;
86 | src: local('Roboto Light'), local('Roboto-Light'), url(I3S1wsgSg9YCurV6PUkTOYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
87 | unicode-range: U+0370-03FF;
88 | }
89 | /* vietnamese */
90 | @font-face {
91 | font-family: 'Roboto';
92 | font-style: normal;
93 | font-weight: 300;
94 | src: local('Roboto Light'), local('Roboto-Light'), url(NYDWBdD4gIq26G5XYbHsFIX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
95 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
96 | }
97 | /* latin-ext */
98 | @font-face {
99 | font-family: 'Roboto';
100 | font-style: normal;
101 | font-weight: 300;
102 | src: local('Roboto Light'), local('Roboto-Light'), url(Pru33qjShpZSmG3z6VYwnYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
103 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
104 | }
105 | /* latin */
106 | @font-face {
107 | font-family: 'Roboto';
108 | font-style: normal;
109 | font-weight: 300;
110 | src: local('Roboto Light'), local('Roboto-Light'), url(Hgo13k-tfSpn0qi1SFdUfZBw1xU1rKptJj_0jans920.woff2) format('woff2');
111 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
112 | }
113 | /* cyrillic-ext */
114 | @font-face {
115 | font-family: 'Roboto';
116 | font-style: italic;
117 | font-weight: 300;
118 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at_ZraR2Tg8w2lzm7kLNL0-w.woff2) format('woff2');
119 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
120 | }
121 | /* cyrillic */
122 | @font-face {
123 | font-family: 'Roboto';
124 | font-style: italic;
125 | font-weight: 300;
126 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at14sYYdJg5dU2qzJEVSuta0.woff2) format('woff2');
127 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
128 | }
129 | /* greek-ext */
130 | @font-face {
131 | font-family: 'Roboto';
132 | font-style: italic;
133 | font-weight: 300;
134 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at1BW26QxpSj-_ZKm_xT4hWw.woff2) format('woff2');
135 | unicode-range: U+1F00-1FFF;
136 | }
137 | /* greek */
138 | @font-face {
139 | font-family: 'Roboto';
140 | font-style: italic;
141 | font-weight: 300;
142 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0atwt_Rm691LTebKfY2ZkKSmI.woff2) format('woff2');
143 | unicode-range: U+0370-03FF;
144 | }
145 | /* vietnamese */
146 | @font-face {
147 | font-family: 'Roboto';
148 | font-style: italic;
149 | font-weight: 300;
150 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at9DiNsR5a-9Oe_Ivpu8XWlY.woff2) format('woff2');
151 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
152 | }
153 | /* latin-ext */
154 | @font-face {
155 | font-family: 'Roboto';
156 | font-style: italic;
157 | font-weight: 300;
158 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at6E8kM4xWR1_1bYURRojRGc.woff2) format('woff2');
159 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
160 | }
161 | /* latin */
162 | @font-face {
163 | font-family: 'Roboto';
164 | font-style: italic;
165 | font-weight: 300;
166 | src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(7m8l7TlFO-S3VkhHuR0at4gp9Q8gbYrhqGlRav_IXfk.woff2) format('woff2');
167 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
168 | }
169 |
--------------------------------------------------------------------------------
/layouts/less/main.less:
--------------------------------------------------------------------------------
1 | /* Reset */
2 | * { margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
3 |
4 | /* HTML Primitives */
5 | body {
6 | font-family: Roboto, sans-serif;
7 | font-size: 16px;
8 | font-style: normal;
9 | font-weight: 300;
10 | letter-spacing: normal;
11 | line-height: 26px;
12 | text-transform: none;
13 | color: #2c2d30;
14 | }
15 |
16 | h1, h2, h3, h4, h5, h6 {
17 | font-family: "Open Sans", sans-serif;
18 | font-style: normal;
19 | font-weight: 800;
20 | letter-spacing: normal;
21 | line-height: 46px;
22 | text-transform: none;
23 | color: #000000;
24 | }
25 |
26 | p { margin-bottom: 20px; }
27 |
28 | a { color: #1d74f2; text-decoration: none; }
29 | a:hover, a:focus { color: #1d74f2; text-decoration: underline; }
30 | a:active { color: #1d74f2; }
31 |
32 | ul { margin-bottom: 20px; list-style-position:inside; }
33 | ol { margin-bottom: 20px; list-style-position:inside; }
34 | ul ul, ol ol { margin-bottom:0; }
35 | ul ul, ol ol {
36 | margin-left: 30px;
37 | }
38 |
39 | ul li, ol li {
40 | list-style-position: outside;
41 | margin-left: 1em;
42 | }
43 |
44 | blockquote {
45 | margin: 10px 10px 20px;
46 | padding: 9px;
47 | background-color: #f8f8f8;
48 | color: #666;
49 | border-left: 5px solid #ddd;
50 | font: 14px/20px Georgia, Times, serif;
51 | quotes: "\201C" "\201D";
52 |
53 | p { margin: 0; }
54 | &:before { content: none; font-weight: bold; }
55 | &:after { content: none; font-weight: bold; }
56 | &:last-child { margin-bottom: 0px; }
57 | }
58 |
59 | a.no-decoration, a.no-decoration:hover,
60 | a.no-decoration:visited, a.no-decoration:active {
61 | text-decoration: none;
62 | color: black;
63 | }
64 |
65 | pre, code {
66 | background-color: #eee;
67 | display:block;
68 | padding:10px;
69 | }
70 |
71 | pre {
72 | margin-bottom: 20px;
73 | white-space: pre-wrap; /* css-3 */
74 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
75 | white-space: -pre-wrap; /* Opera 4-6 */
76 | white-space: -o-pre-wrap; /* Opera 7 */
77 | word-wrap: break-word; /* Internet Explorer 5.5+ */
78 |
79 | &.example-code {
80 | font-size: 18px;
81 | margin-bottom: 0px;
82 | overflow-wrap: break-word;
83 | word-break: break-all;
84 |
85 | &.big {
86 | font-size: 22px;
87 | }
88 | }
89 | }
90 |
91 | code {
92 | display: inline;
93 | padding: 0px;
94 | overflow-wrap: break-word;
95 | word-break: break-all;
96 | }
97 |
98 | header, footer {
99 | width: 100%;
100 | max-width: 820px;
101 | margin: 0 auto;
102 | }
103 |
104 | header {
105 | padding: 0;
106 | margin-bottom: 1.5rem;
107 | border-bottom: 1px solid #ddd;
108 | }
109 |
110 | /* Header */
111 | .header-section {
112 | padding: 2rem 0;
113 |
114 | &.right {
115 | padding-top: 10px;
116 | margin-left: 10px;
117 | }
118 | }
119 |
120 | .header-title {
121 | margin-left: 10px;
122 | font-weight: 700;
123 | font-size: 32px;
124 | display: inline-block;
125 | vertical-align: middle;
126 | font-family: "Open Sans", sans-serif;
127 | font-style: normal;
128 | letter-spacing: normal;
129 | line-height: 46px;
130 | color: #000000;
131 |
132 | a {
133 | color: #000000;
134 | cursor: pointer;
135 | text-decoration: none;
136 |
137 | &:hover {
138 | color: #357edd;
139 | }
140 | }
141 | }
142 |
143 | #logo {
144 | display: inline-block;
145 | vertical-align: middle;
146 | height: 60px;
147 | }
148 |
149 | .home-page #logo {
150 | height: 90px
151 | }
152 |
153 | /* Footer */
154 | footer {
155 | padding: 1rem;
156 | color: #2c2d30;
157 | border-top:1px solid #ccc;
158 | font-size:11px;
159 | line-height:26px;
160 | }
161 |
162 | .footer-section.right {
163 | padding-top: 20px;
164 | }
165 |
166 | #footer-logo {
167 | height:48px;
168 | vertical-align: middle;
169 | margin-top: 10px;
170 | }
171 |
172 | .copyright {
173 | padding-top: 1.5rem;
174 |
175 | a {
176 | color: #357edd;
177 | cursor: pointer;
178 | text-decoration: underline;
179 | }
180 | }
181 |
182 | /* Nav-links */
183 | .nav-link {
184 | display: inline-block;
185 | border-color: transparent;
186 | font-size: 1rem;
187 | font-weight: 600;
188 | text-transform: uppercase;
189 | color: #5A626E;
190 | cursor: pointer;
191 | margin-left: 20px;
192 |
193 | &:hover {
194 | color: #357edd;
195 | }
196 | &:first-child {
197 | margin-left: 0;
198 | }
199 | }
200 |
201 | /* Body */
202 | .container {
203 | width: 820px;
204 | max-width: 95%;
205 | margin: 0 auto;
206 | }
207 |
208 | /* Header links */
209 | .header-link:hover span#link-symbol {
210 | display: block;
211 | }
212 |
213 | .header-link span#link-symbol {
214 | float: left;
215 | margin-left: -35px;
216 | color: #999;
217 | display: none;
218 | }
219 |
220 | /* Code and examples */
221 | .multihash {
222 | margin: 30px 0px;
223 | margin-bottom: 20px;
224 | }
225 |
226 | .c-0, .c-1, .c-2 {
227 | color: white;
228 | }
229 |
230 | .c-0 {
231 | color: #a155c1;
232 | }
233 |
234 | .c-1 {
235 | color: #65ac39;
236 | }
237 |
238 | .c-2 {
239 | color: #3845aa;
240 | }
241 | .label {
242 | padding: 1px;
243 | font-weight: bolder;
244 | font-size: 15px;
245 |
246 | code {
247 | background: none;
248 | }
249 |
250 | &.c-0 {
251 | margin-left: 0px;
252 | }
253 | &.c-1 {
254 | margin-left: 25px;
255 | }
256 | &.c-2 {
257 | margin-left: 50px;
258 | }
259 | }
260 |
261 |
262 | .example {
263 | font-size: 15px;
264 | opacity: 0.9;
265 | text-align: right;
266 | }
267 | .example-legend {
268 | padding: 10px;
269 | border: 2px solid #eee;
270 | margin-bottom: 20px;
271 | }
272 | hr {
273 | margin: 40px 0px;
274 | color: #eee;
275 | }
276 |
277 |
278 | .mfc {
279 | font-weight: 300;
280 | }
281 |
282 | .mfc-multihash { color: #a155c1; }
283 | .mfc-multiaddr { color: #1d74f2; }
284 | .mfc-multibase { color: #3845aa; }
285 | .mfc-multicodec { color: #65ac39; }
286 | .mfc-multistream { color: #1e8c99; }
287 | .mfc-multigram { color: #167f71; }
288 | .mfc-multikey { color: #a81919; }
289 |
290 | .project-list li {
291 | margin: 10px 1em;
292 | list-style-position: outside;
293 | }
294 | .project-list img {
295 | height: 64px;
296 | margin: 5px;
297 | vertical-align: middle;
298 | }
299 | .about-logos > div {
300 | font-size: 24px;
301 | vertical-align: middle;
302 | height: 70px;
303 | min-width: 45%;
304 | display: inline-block;
305 | }
306 |
307 | /* Responsive utilities */
308 | .hide-ns {
309 | display: initial;
310 | }
311 |
312 | .show-ns {
313 | display: none;
314 | }
315 |
316 | @media all and (min-width: 768px) {
317 | .hide-ns {
318 | display: none;
319 | }
320 | .show-ns {
321 | display: initial;
322 | }
323 |
324 | header, footer {
325 | display: table;
326 | }
327 |
328 | .header-section, .footer-section {
329 | display: table-cell;
330 | vertical-align: middle;
331 | white-space: nowrap;
332 | }
333 |
334 | .header-section {
335 | padding: 0;
336 | height: 125px;
337 | }
338 |
339 | .header-section.right, .footer-section.right {
340 | text-align: right;
341 | padding-right: 10px;
342 | }
343 |
344 | .home-page .header-title {
345 | font-size: 52px;
346 | }
347 |
348 | .footer-section.right {
349 | padding-top: 0;
350 | }
351 | }
352 |
--------------------------------------------------------------------------------
/content/multiaddr.md:
--------------------------------------------------------------------------------
1 | +++
2 | base_url = "../"
3 | title = "Multiaddr"
4 | multiformat = "multiaddr"
5 | stars = "multiformats/multiaddr"
6 |
7 | layout = "abc"
8 | type = "homea"
9 |
10 | [_build]
11 | list = 'always'
12 | publishResources = true
13 | render = 'always'
14 | +++
15 |
16 | ⚠️️ _(Note: this page is a work in progress; [please improve it here](https://github.com/multiformats/website/blob/master/content/multiaddr.md))_ ⚠️️
17 |
18 | > ## Self-describing network addresses
19 |
20 | Multiaddr is a format for encoding addresses from various well-established network protocols. It is useful to write applications that future-proof their use of addresses, and allow multiple transport protocols and addresses to coexist.
21 |
22 |
23 | ## Network Protocol Ossification
24 |
25 | The current network addressing scheme on the internet **is not self-describing**. Traditional addresses leave much ambiguity. For example, it's not always clear which transport protocol (TCP, UDP, or others) is being used. This ambiguity forces developers to write application-specific code that assumes a certain protocol, which causes "ossification"—rigid code that cannot easily adapt to future network protocols.
26 |
27 | ### Problematic Examples:
28 |
29 | Consider the following traditional addresses:
30 |
31 | ```
32 | 127.0.0.1:9090 # IPv4. Is this TCP, UDP, or something else?
33 | [::1]:3217 # IPv6. Is this TCP, UDP, or something else?
34 |
35 | http://127.0.0.1/baz.jpg # Defaults to TCP port 80, but what if we wanted to use QUIC?
36 | http://foo.com/bar/baz.jpg # Uses DNS resolution but defaults to TCP on port 80.
37 | //foo.com:1234 # Ambiguous—what protocol does this address use after DNS resolution?
38 | ```
39 |
40 | In these cases:
41 | - `127.0.0.1:9090` could refer to either TCP or UDP, forcing developers to make assumptions.
42 | - DNS-based addresses (`http://foo.com/bar/baz.jpg`) default to TCP, but there’s no flexibility for newer protocols like QUIC without making breaking changes to the application.
43 |
44 | ### The Solution: Fully Qualified Addresses with Multiaddr
45 |
46 | Multiaddr solves this by providing **self-describing addresses**. Each part of the address specifies both the protocol and the network address, making it clear how to interact with the resource. This approach future-proofs applications, allowing them to adapt to new transport protocols.
47 |
48 | #### Fully Qualified Examples with Multiaddr:
49 |
50 | ```
51 | /ip4/127.0.0.1/udp/9090/quic # IPv4 address using UDP on port 9090, with QUIC
52 | /ip6/::1/tcp/3217 # IPv6 address using TCP on port 3217
53 | /ip4/127.0.0.1/tcp/80/http/baz.jpg # IPv4 address using TCP on port 80, accessing an HTTP resource
54 | /dns4/foo.com/tcp/80/http/bar/baz.jpg # DNS resolution (IPv4) using TCP on port 80, accessing an HTTP resource
55 | /dns6/foo.com/tcp/443/https # DNS resolution (IPv6) using TCP on port 443 for HTTPS
56 | ```
57 |
58 | In these examples:
59 | - `/ip4/127.0.0.1/udp/9090/quic` specifies the use of UDP and QUIC, removing ambiguity.
60 | - `/dns4/foo.com/tcp/80/http/bar/baz.jpg` clearly indicates that the address resolves to IPv4 via DNS and uses TCP to access an HTTP resource.
61 |
62 | By explicitly stating the protocol and transport, Multiaddr eliminates the assumptions that lead to network protocol ossification.
63 |
64 | ---
65 |
66 |
67 |
68 | ## Multiaddr Format
69 |
70 | A multiaddr value is a _recursive_ `(TLV)+` (type-length-value repeating) encoding. It has two forms:
71 |
72 | - a _human-readable version_ to be used when printing to the user (UTF-8)
73 | - a _binary-packed version_ to be used in storage, transmissions on the wire, and as a primitive in other formats.
74 |
75 | ### The human-readable version:
76 |
77 | - path notation nests protocols and addresses, for example: `/ip4/127.0.0.1/udp/4023/quic` (this is the repeating part).
78 | - a protocol MAY be only a code, or also have an address value (nested under a `/`) (eg. `/quic` and `/ip4/127.0.0.1`)
79 | - the _type_ \ is a string code identifying the network protocol. The table of protocols is configurable. The default table is the [multicodec](https://github.com/multiformats/multicodec) table.
80 | - the _value_ \ is the network address value, in natural string form.
81 |
82 | Human-readable encoding (psuedo regex)
83 |
84 | {{% multiformat
85 | syntax="(/ /) +"
86 | labels="protocol code as a string|the address itself (human readable)|the pattern repeats, protocols encapsulate other protocols"
87 | example="/ip4/127.0.0.1/tcp/4000"
88 | %}}
89 |
90 |
91 | ### The binary-packed version:
92 |
93 | - the _type_ \ is a variable integer identifying the network protocol. The table of protocols is configurable. The default table is the [multicodec](https://github.com/multiformats/multicodec) table.
94 | - the _length_ is an [unsigned variable integer](https://github.com/multiformats/unsigned-varint) counting the length of the address value, in bytes.
95 | - **The _length_ is omitted by protocols who have an exact address value size, or no address value.**
96 | - the _value_ \ is the network address value, of length `L`.
97 | - **The _value_ is omitted by protocols who have no address value.**
98 |
99 | Binary-packed encoding (psuedo regex)
100 |
101 | {{% multiformat
102 | syntax="( ) +"
103 | labels="protocol code as a varint|the address value itself (binary)|the pattern repeats, protocols encapsulate other protocols"
104 | example="047f000001060fa0"
105 | %}}
106 |
107 |
108 | ## Implementations
109 |
110 | These implementations are available:
111 |
112 | - [js-multiaddr](https://github.com/multiformats/js-multiaddr) - stable
113 | - [go-multiaddr](https://github.com/multiformats/go-multiaddr) - stable
114 | - [java-multiaddr](https://github.com/multiformats/java-multiaddr) - stable
115 | - [hs-multiaddr](https://github.com/basile-henry/hs-multiaddr) - draft
116 | - [py-multiaddr](https://github.com/sbuss/py-multiaddr) - alpha
117 | - [rust-multiaddr](https://github.com/multiformats/rust-multiaddr) - draft
118 | - [cs-multiaddress](https://github.com/tabrath/cs-multiaddress) - alpha
119 | - [erlang-multiaddr](https://github.com/helium/erlang-multiaddr) - alpha
120 | - [net-ipfs-core](https://github.com/richardschneider/net-ipfs-core) - stable
121 | - [swift-multiaddr](https://github.com/lukereichold/swift-multiaddr) - stable
122 | - [(add yours here)](https://github.com/multiformats/website/blob/master/content/multiaddr.md)
123 |
124 | ## Examples
125 |
126 | - **javascript**
127 | ```javascript
128 | import { multiaddr } from '@multiformats/multiaddr'
129 |
130 | // Example 1: Simple IPv4 and UDP
131 | const addr1 = multiaddr("/ip4/127.0.0.1/udp/1234")
132 | // Multiaddr(/ip4/127.0.0.1/udp/1234)
133 |
134 | console.log(addr1.bytes)
135 | //
136 |
137 | console.log(addr1.toString())
138 | // '/ip4/127.0.0.1/udp/1234'
139 |
140 | console.log(addr1.protos())
141 | // [
142 | // {code: 4, name: 'ip4', size: 32},
143 | // {code: 273, name: 'udp', size: 16}
144 | // ]
145 |
146 | console.log(addr1.nodeAddress())
147 | // {
148 | // family: 4,
149 | // port: 1234,
150 | // address: "127.0.0.1"
151 | // }
152 |
153 | console.log(addr1.encapsulate('/sctp/5678').toString())
154 | // '/ip4/127.0.0.1/udp/1234/sctp/5678'
155 |
156 |
157 | // Example 2: IPv6 and TCP
158 | const addr2 = multiaddr("/ip6/::1/tcp/8080")
159 | // Multiaddr(/ip6/::1/tcp/8080)
160 |
161 | console.log(addr2.bytes)
162 | //
163 |
164 | console.log(addr2.toString())
165 | // '/ip6/::1/tcp/8080'
166 |
167 | console.log(addr2.protos())
168 | // [
169 | // {code: 41, name: 'ip6', size: 128},
170 | // {code: 6, name: 'tcp', size: 16}
171 | // ]
172 |
173 | console.log(addr2.nodeAddress())
174 | // {
175 | // family: 6,
176 | // port: 8080,
177 | // address: "::1"
178 | // }
179 |
180 |
181 | // Example 3: DNS and HTTPS
182 | const addr3 = multiaddr("/dns4/example.com/tcp/443/https")
183 | // Multiaddr(/dns4/example.com/tcp/443/https)
184 |
185 | console.log(addr3.toString())
186 | // '/dns4/example.com/tcp/443/https'
187 |
188 | console.log(addr3.encapsulate('/p2p-circuit').toString())
189 | // '/dns4/example.com/tcp/443/https/p2p-circuit'
190 | ```
191 |
192 |
193 | - **go**
194 | ```go
195 | import ma "github.com/multiformats/go-multiaddr"
196 |
197 | // construct from a string (err signals parse failure)
198 | m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
199 |
200 | // construct from bytes (err signals parse failure)
201 | m2, err := ma.NewMultiaddrBytes(m1.Bytes())
202 |
203 | // true
204 | strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234")
205 | strings.Equal(m1.String(), m2.String())
206 | bytes.Equal(m1.Bytes(), m2.Bytes())
207 | m1.Equal(m2)
208 | m2.Equal(m1)
209 | ```
210 |
211 |
212 | ## F.A.Q.
213 |
214 | 1. **Why use Multiaddr instead of traditional addressing?**
215 | Multiaddr is designed to be future-proof, allowing easy adaptation to new protocols and network designs without breaking legacy applications. It removes ambiguity about what transport protocol or address family is being used.
216 |
217 | 2. **How does Multiaddr handle new protocols?**
218 | The format is extensible. New protocols are simply added to the multicodec table. This allows Multiaddr to support emerging protocols without requiring changes to the core format.
219 |
220 | 3. **What is the advantage of the binary-packed format?**
221 | The binary format is more compact and efficient for storage and transmission, especially useful in low-bandwidth or resource-constrained environments.
222 |
223 |
224 | ## About
225 |
226 | ### Specification
227 |
228 | We will be submitting an RFC to the IETF. It will be worked on [at the multiaddr repo](https://github.com/multiformats/multiaddr).
229 |
230 | ### Credits
231 |
232 | The Multiaddr format was invented by [@jbenet](https://github.com/jbenet), and refined by the [IPFS Team](https://github.com/ipfs). It is now maintained by the Multiformats community. The Multiaddr implementations are written by a variety of authors, whose hard work has made future-proofing and upgrading hash functions much easier. Thank you!
233 |
234 | ### Open Source
235 |
236 | The Multiaddr format (this documentation and the specification) is Open Source software, licensed under the MIT License and patent-free. The multiaddr implementations listed here are also Open Source software. Please contribute to make them great! Your bug reports, new features, and documentation improvements will benefit everyone.
237 |
238 | ### Part of the Multiformats Project
239 |
240 | Multiaddr is part of [the Multiformats Project](../), a collection of protocols which aim to future-proof systems, today. [Check out the other multiformats](../#multiformat-protocols). It is also maintained and sponsored by [Protocol Labs](http://ipn.io).
241 |
242 |
250 |
--------------------------------------------------------------------------------
/content/multihash.md:
--------------------------------------------------------------------------------
1 | +++
2 | base_url = "../"
3 | title = "Multihash"
4 | multiformat = "multihash"
5 | stars = "multiformats/multihash"
6 | +++
7 |
8 | > ## Self-describing hashes
9 |
10 | Multihash is a protocol for differentiating outputs from various well-established hash functions, addressing size + encoding considerations. It is useful to write applications that future-proof their use of hashes, and allow multiple hash functions to coexist.
11 |
12 |
13 |
14 | - [Safer, easier cryptographic hash function upgrades](#safer-easier-cryptographic-hash-function-upgrades)
15 | - [The Multihash Format](#the-multihash-format)
16 | - [Implementations](#implementations)
17 | - [Examples](#examples)
18 | - [F.A.Q.](#f-a-q)
19 | - [About](#about)
20 | - [Specification](#specification)
21 | - [Credits](#credits)
22 | - [Open Source](#open-source)
23 | - [Part of the Multiformats Project](#part-of-the-multiformats-project)
24 |
25 | ### Safer, easier cryptographic hash function upgrades
26 |
27 | Multihash is particularly important in systems which depend on [**cryptographically secure hash functions**](https://en.wikipedia.org/wiki/Cryptographic_hash_function). Attacks [may break](https://en.wikipedia.org/wiki/Hash_function_security_summary) the cryptographic properties of secure hash functions. These [_cryptographic breaks_](https://en.wikipedia.org/wiki/Cryptanalysis) are particularly painful in large tool ecosystems, where tools may have made assumptions about hash values, such as function and digest size. Upgrading becomes a nightmare, as all tools which make those assumptions would have to be upgraded to use the new hash function and new hash digest length. Tools may face serious interoperability problems or error-prone special casing.
28 |
29 | > How many programs out there assume a git hash is a sha1 hash?
30 | >
31 | > How many scripts assume the hash value digest is **_exactly_** 160 bits?
32 | >
33 | > How many tools will break when these values change?
34 | >
35 | > How many programs will fail silently when these values change?
36 |
37 | **This is precisely where Multihash shines. It was designed for upgrading.**
38 |
39 | When using Multihash, a system warns the consumers of its hash values that these may have to be upgraded in case of a break. Even though the system may still only use a single hash function at a time, the use of multihash makes it clear to applications that hash values may use different hash functions or be longer in the future. Tooling, applications, and scripts can avoid making assumptions about the length, and read it from the multihash value instead. This way, the vast majority of tooling -- which may not do any checking of hashes -- would not have to be upgraded at all. This vastly simplifies the upgrade process, avoiding the waste of hundreds or thousands of software engineering hours, deep frustrations, and high blood pressure.
40 |
41 | ## The Multihash Format
42 |
43 | A multihash follows the `TLV` (type-length-value) pattern.
44 |
45 | - the _type_ \ is an [unsigned variable integer](https://github.com/multiformats/unsigned-varint) identifying the hash function. There is a default table, and it is configurable. The default table is [the multicodec table](https://github.com/multiformats/multicodec/blob/master/table.csv).
46 | - the _length_ \ is an [unsigned variable integer](https://github.com/multiformats/unsigned-varint) counting the length of the digest, in bytes
47 | - the _value_ \ is the hash function digest, with a length of exactly \ bytes.
48 |
49 | {{% multiformat
50 | syntax=" "
51 | labels="unsigned varint code of the hash function being used|unsigned varint digest length, in bytes|hash function output value, with length matching the prefixed length value"
52 | description="foo"
53 | %}}
54 |
55 | For example:
56 |
57 | {{% multihash
58 | fnName="sha2-256"
59 | fnCode="12"
60 | fnCodeVarint="12"
61 | length="32"
62 | lengthCode="20"
63 | digest="41dd7b6443542e75701aa98a0c235951a28a0d851b11564d20022ab11d2589a8"
64 | multihash="122041dd7b6443542e75701aa98a0c235951a28a0d851b11564d20022ab11d2589a8"
65 | %}}
66 |
67 | ## Implementations
68 |
69 | These implementations are available:
70 |
71 | - [go-multihash](//github.com/multiformats/go-multihash)
72 | - [java-multihash](//github.com/multiformats/java-multihash)
73 | - [js-multihash](//github.com/multiformats/js-multihash)
74 | - [clj-multihash](//github.com/multiformats/clj-multihash)
75 | - rust-multihash
76 | - [by @dignifiedquire](//github.com/dignifiedquire/rust-multihash)
77 | - [by @google](//github.com/google/rust-multihash)
78 | - [haskell-multihash](//github.com/LukeHoersten/multihash)
79 | - [py-multihash](//github.com/multiformats/py-multihash)
80 | - [elixir-multihash](//github.com/zabirauf/ex_multihash), [elixir-multihashing](//github.com/candeira/ex_multihashing)
81 | - [swift-multihash](//github.com/NeoTeo/SwiftMultihash)
82 | - [ruby-multihash](//github.com/neocities/ruby-multihash)
83 | - [MultiHash.Net](//github.com/MCGPPeters/MultiHash.Net)
84 | - [cs-multihash](//github.com/multiformats/cs-multihash)
85 | - [scala-multihash](//github.com/mediachain/scala-multihash)
86 | - [php-multihash](//github.com/Fil/php-multihash)
87 | - [net-ipfs-core](//github.com/richardschneider/net-ipfs-core)
88 | - [erlang-multihash](//github.com/helium/erlang-multihash)
89 | - [(add yours here)](https://github.com/multiformats/website/blob/master/content/multihash.md)
90 |
91 | ## Examples
92 |
93 | The following multihash examples are different hash function outputs of the same exact input:
94 |
95 | ```
96 | Merkle–Damgård
97 | ```
98 |
99 | The multihash examples are chosen to show different hash functions and different hash digest lengths at play.
100 |
101 |
102 |
103 | ### sha1 - 160 bits
104 |
105 | {{% multihash
106 | fnName="sha1"
107 | fnCode="11"
108 | fnCodeVarint="11"
109 | length="20"
110 | lengthCode="14"
111 | digest="8a173fd3e32c0fa78b90fe42d305f202244e2739"
112 | multihash="11148a173fd3e32c0fa78b90fe42d305f202244e2739"
113 | %}}
114 |
115 | ### sha2-256 - 256 bits (aka sha256)
116 |
117 | {{% multihash
118 | fnName="sha2-256"
119 | fnCode="12"
120 | fnCodeVarint="12"
121 | length="32"
122 | lengthCode="20"
123 | digest="41dd7b6443542e75701aa98a0c235951a28a0d851b11564d20022ab11d2589a8"
124 | multihash="122041dd7b6443542e75701aa98a0c235951a28a0d851b11564d20022ab11d2589a8"
125 | %}}
126 |
127 | ### sha2-512 - 256 bits
128 |
129 | {{% multihash
130 | fnName="sha2-512"
131 | fnCode="13"
132 | fnCodeVarint="13"
133 | length="32"
134 | lengthCode="20"
135 | digest="52eb4dd19f1ec522859e12d89706156570f8fbab1824870bc6f8c7d235eef5f4"
136 | multihash="132052eb4dd19f1ec522859e12d89706156570f8fbab1824870bc6f8c7d235eef5f4"
137 | %}}
138 |
139 | Note: this is the actual SHA-512 (as per code `0x13`) truncated to 256 bits; some libraries support an hash called SHA-512/256 that has the same 256 bit length but with a different initialization vector (as defined in [FIPS 180-4](https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=910977)).
140 |
141 | ### sha2-512 - 512 bits (aka sha512)
142 |
143 | {{% multihash
144 | fnName="sha2-512"
145 | fnCode="13"
146 | fnCodeVarint="13"
147 | length="64"
148 | lengthCode="40"
149 | digest="52eb4dd19f1ec522859e12d89706156570f8fbab1824870bc6f8c7d235eef5f4c2cbbafd365f96fb12b1d98a0334870c2ce90355da25e6a1108a6e17c4aaebb0"
150 | multihash="134052eb4dd19f1ec522859e12d89706156570f8fbab1824870bc6f8c7d235eef5f4c2cbbafd365f96fb12b1d98a0334870c2ce90355da25e6a1108a6e17c4aaebb0"
151 | %}}
152 |
153 | ### blake2b-512 - 512 bits
154 |
155 | {{% multihash
156 | fnName="blake2b-512"
157 | fnCode="b240"
158 | fnCodeVarint="c0e402"
159 | length="64"
160 | lengthCode="40"
161 | digest="d91ae0cb0e48022053ab0f8f0dc78d28593d0f1c13ae39c9b169c136a779f21a0496337b6f776a73c1742805c1cc15e792ddb3c92ee1fe300389456ef3dc97e2"
162 | multihash="c0e40240d91ae0cb0e48022053ab0f8f0dc78d28593d0f1c13ae39c9b169c136a779f21a0496337b6f776a73c1742805c1cc15e792ddb3c92ee1fe300389456ef3dc97e2"
163 | %}}
164 |
165 | ### blake2b-256 - 256 bits
166 |
167 | {{% multihash
168 | fnName="blake2b-256"
169 | fnCode="b220"
170 | fnCodeVarint="a0e402"
171 | length="32"
172 | lengthCode="20"
173 | digest="7d0a1371550f3306532ff44520b649f8be05b72674e46fc24468ff74323ab030"
174 | multihash="a0e402207d0a1371550f3306532ff44520b649f8be05b72674e46fc24468ff74323ab030"
175 | %}}
176 |
177 | ### blake2s-256 - 256 bits
178 |
179 | {{% multihash
180 | fnName="blake2s-256"
181 | fnCode="b260"
182 | fnCodeVarint="e0e402"
183 | length="32"
184 | lengthCode="20"
185 | digest="a96953281f3fd944a3206219fad61a40b992611b7580f1fa091935db3f7ca13d"
186 | multihash="e0e40220a96953281f3fd944a3206219fad61a40b992611b7580f1fa091935db3f7ca13d"
187 | %}}
188 |
189 | ### blake2s-128 - 128 bits
190 |
191 | {{% multihash
192 | fnName="blake2s-128"
193 | fnCode="b250"
194 | fnCodeVarint="d0e402"
195 | length="16"
196 | lengthCode="10"
197 | digest="0a4ec6f1629e49262d7093e2f82a3278"
198 | multihash="d0e402100a4ec6f1629e49262d7093e2f82a3278"
199 | %}}
200 |
201 | ## F.A.Q.
202 |
203 | > #### Q: Why have digest length as a separate number?
204 |
205 | Because combining hash function code and hash digest length ends up with a function code really meaning "function-and-digest-size-code". Makes using custom digest sizes annoying, and much less flexible. We would need hundreds of codes for all the combinations people would want to use.
206 |
207 | > #### Q: Why varints (variable integers)?
208 |
209 | So that we have no limitation on functions or lengths.
210 |
211 | > #### Q: What kind of varints?
212 |
213 | A Most Significant Bit unsigned varint, as defined by the [multiformats/unsigned-varint](https://github.com/multiformats/unsigned-varint) doc.
214 |
215 | > #### Q: Don't we have to agree on a table of functions?
216 |
217 | Yes, but we already have to agree on functions, so this is not hard. The table even leaves some room for custom function codes.
218 |
219 | > #### Q: Why not use `"sha256:"`?
220 |
221 | For three reasons:
222 |
223 | - (1) Multihash and all other multiformats endeavor to make the values be "in-band" and to be treated as the original value. The construction `:` is human readable and tuned for some outputs. Hashes are stored compactly in their binary representation. Forcing applications to always convert is cumbersome (split on `:`, turn the right hand side into binary, remove the `:`, concat).
224 |
225 | - (2) Multihash and all other multiformats endeavor to be as compact as possible, which means a binary packed representation will help save a lot of space in systems that use millions or billions of hashes. For example, a 100 TB file in IPFS may have as many as 400 million subobjects, which would mean 400 million hashes.
226 | ```
227 | 400,000,000 hashes * (7 - 2) bytes = 2 GB
228 | ```
229 |
230 | - (3) The length is extremely useful when hashes are truncated. This is a type of choice that should be expressed in-band. It is also useful when hashes are concatenated or kept in lists, and when scanning a stream quickly.
231 |
232 | > #### Q: Is Multihash only for cryptographic hashes?
233 | > #### What about non-cryptographic hashes like `murmur3`, `cityhash`, etc?
234 |
235 | We decided to make Multihash work for all hash functions, not just cryptographic hash functions. The same kind of choices that people make around
236 |
237 | We wanted to be able to include `MD5` and `SHA1`, as they are widely used even now, despite no longer being secure. Ultimately, we could consider these cryptographic hash functions that have transitioned into non-cryptographic hash functions. Perhaps all of them eventually do.
238 |
239 | > #### Q: How do I add hash functions to the table?
240 |
241 | Three options to add custom hash functions:
242 |
243 | - (1) If other applications would benefit from this hash function, propose it at [the multihash repo](https://github.com/multiformats/multihash/issues/)
244 | - (2) If your function is only for your application, you can add a hash function to the table in a range reserved specially for this purpose. See the table.
245 | - (3) If you need to use a completely custom table, most implementations support loading a separate hash function table.
246 |
247 | > #### Q. I want to upgrade a large system to use Multihash. Could you help me figure out how?
248 |
249 | Sure, ask for help in IRC, github, or other fora. See the [Multiformats Community](../#contribute-community) listing.
250 |
251 | > #### Q. I wish Multihash would _______. I really hate _______.
252 |
253 | Those are not questions. But please leave any and all feedback over in [the Multihash repo](https://github.com/multiformats/multihash/issues/). It will help us improve the project and make sure it addresses our users' needs. Thanks!
254 |
255 | ## About
256 |
257 | ### Specification
258 |
259 | There is a spec in progress, which we hope to submit to the IETF. It is being worked on [at this pull-request](https://github.com/multiformats/multihash/pull/41).
260 |
261 | ### Credits
262 |
263 | The Multihash format was invented by [@jbenet](https://github.com/jbenet), and refined by the [IPFS Team](https://github.com/ipfs). It is now maintained by the Multiformats community. The Multihash implementations are written by a variety of authors, whose hard work has made future-proofing and upgrading hash functions much easier. Thank you!
264 |
265 | ### Open Source
266 |
267 | The Multihash format (this documentation and the specification) is Open Source software, licensed under the MIT License and patent-free. The multihash implementations listed here are also Open Source software. Please contribute to make them great! Your bug reports, new features, and documentation improvements will benefit everyone.
268 |
269 | ### Part of the Multiformats Project
270 |
271 | Multihash is part of [the Multiformats Project](../), a collection of protocols which aim to future-proof systems, today. [Check out the other multiformats](../#multiformat-protocols). It is also maintained and sponsored by [Protocol Labs](http://ipn.io).
272 |
273 |
285 |
--------------------------------------------------------------------------------