Skip to content
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

Decide how to handle -1 in Prefix. #11

Closed
Stebalien opened this issue Jun 20, 2017 · 1 comment
Closed

Decide how to handle -1 in Prefix. #11

Stebalien opened this issue Jun 20, 2017 · 1 comment

Comments

@Stebalien
Copy link
Member

Currently, Prefix.MhLength is an int and -1 can be (and is) used to mean "default length". Unfortunately, this means:

  1. cid1.Bytes() == cid2.Bytes() does not imply cid1.Prefix() == cid2.Prefix().
  2. Prefix.Bytes() is broken.

Solutions:

  1. Make it a uint64, provide some convenience constructors constructors (e.g. func V1Prefix(codec uint64, mhType uint64) Prefix). This will break things.
  2. Fix Prefix.Bytes() and provide an Equals method (less convenient in the long run).

Thoughts?

@Stebalien
Copy link
Member Author

Wrong repo... Moved to ipfs/go-cid#23.

Stebalien added a commit to Stebalien/cid that referenced this issue Aug 30, 2017
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
Stebalien added a commit to Stebalien/cid that referenced this issue Aug 31, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant