-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the spec from the implementation. #14
Update the spec from the implementation. #14
Conversation
Also, @diasdavid how does this work in JavaScript? |
README.md
Outdated
* The CID's version is 0. | ||
* Otherwise, let `N` be the first varint in `cid`. This is the CID's version. | ||
* If `N == 1` (CIDv1): | ||
* THe CID's multicodec is the second varint in `cid` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/THe/The
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the algo JS is doing: https://github.com/ipld/js-cid/blob/master/src/index.js#L18-L87 Some different heuristics, it trusts less the length and relies more on value checking.
README.md
Outdated
@@ -86,10 +86,10 @@ For example: | |||
### CIDv0 | |||
|
|||
CIDv0 is a backwards-compatible version, where: | |||
- the `multibase` is always `base58btc` and implicit (not written) | |||
- the `multibase` defaults to `base58btc` (if not written) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽 same in JS, although ipfs/kubo#4143 might become a thing soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎🏽 ah wait, read this wrong. CIDv0 is always base58, there is no way to change that.
Could you point me to the discussion where this decision 'was made'? Me, @jbenet and @whyrusleeping talked about this extensively and the agreement was not to convert CIDv0 to CIDv0b (which is what is happening with that proposal), instead convert CIDv0 to CIDv1 if a different base is required to be used. |
A decision was never "made" it is just what works with go-cid and there is very little harm in allowing a multibase prefix to a
and ipfs/go-cid#34 (comment) by me:
|
@kevina we posted at the same time, see here to learn about the actual issues: ipfs/go-cid#34 (comment) |
1. CIDv0 only supports SHA256 multihashes. 2. In CIDv0, the multibase *can* be specified but defaults to base58btc. This commit also describes the proper algorithm for decoding CIDs as it's non-obvious. Fixes multiformats#11
b3215dc
to
bbee2b1
Compare
I've updated it to not allow non-base58 CIDv0s. |
No, we shouldn't allow this. Cidv0 is explicitly base58 bare multihash
representing a protobuf object.
…On Thu, Aug 31, 2017, 12:36 PM Steven Allen ***@***.***> wrote:
I've updated it to not allow non-base58 CIDv0s.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABL4HG0mk3RU3Lsq0ypQ_KLfA0TmZIeSks5sdwsvgaJpZM4PH8qu>
.
|
I've now updated the algorithm to explicitly not support non-base58 v0 CIDs. We'll need to fix go-cid (and maybe js-cid) to match this as go-cid, at least, will currently decode multibase CIDv0 CIDs just fine. |
Can I please ask the reason for explicitly forbidding a multibase encoded Cidv0? Also see this comment ipfs/go-cid#34 (comment) I made on relevant issue. |
@Stebalien |
The reason is because cidv0 is a legacy thing, it's very strictly defined
to prevent potential confusion or ambiguity. We don't want to support it
anymore than is necessary.
…On Thu, Aug 31, 2017, 8:55 PM David Dias ***@***.***> wrote:
@Stebalien <https://github.com/stebalien> js-cid limits CIDv0 to its
base58 form
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABL4HECqZ5K12qCwlmJDVdBMLauYEMlvks5sd4AugaJpZM4PH8qu>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @Stebalien :)
2. In CIDv0, the multibase can be specified but defaults to base58btc.This commit also describes the proper algorithm for decoding CIDs as it's non-obvious.
Fixes #11