Unverified Commit 8d1606fc authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #13 from ipfs/feat/cidv1-default-base32

default cidv1 to base32
parents 7a289d95 6927839e
......@@ -14,7 +14,7 @@ type Encoder struct {
// Default return a new default encoder
func Default() Encoder {
return Encoder{Base: mbase.MustNewEncoder(mbase.Base58BTC)}
return Encoder{Base: mbase.MustNewEncoder(mbase.Base32)}
}
// Encode encodes the cid using the parameters of the Encoder
......
......@@ -59,4 +59,12 @@ func TestCidEncoder(t *testing.T) {
testRecode(enc, cidv0str, cidb32str)
testRecode(enc, cidv1str, cidb32str)
testRecode(enc, cidb32str, cidb32str)
enc = Default()
testEncode(enc, cidv0, cidv0str)
testEncode(enc, cidv1, cidb32str)
testRecode(enc, cidv0str, cidv0str)
testRecode(enc, cidv1str, cidb32str)
testRecode(enc, cidb32str, cidb32str)
}
......@@ -96,7 +96,7 @@ bafybeietjgsrl3eqpqpcabv3g6iubytsifvq24xrrhd3juetskltgq7dja.
offset := 0
for len(buf) > 0 {
_, j, _, cidStr := ScanForCid(buf)
if cidStr != "" && cids[idx] != cidStr {
if cidStr != "" && cids[idx] != cidStr {
t.Fatalf("Scan failed, expected %s, got %s (idx=%d offset=%d)", cids[idx], cidStr, idx, offset)
}
buf = buf[j:]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment