Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cid/cid.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def buffer(self) -> bytes:
"""
return b"".join([bytes([self.version]), multicodec.add_prefix(self.codec, self.multihash)])

def encode(self, encoding: str | None = "base58btc") -> bytes:
def encode(self, encoding: str | None = "base32") -> bytes:
"""
Encoded version of the raw representation

Expand Down
1 change: 1 addition & 0 deletions newsfragments/66.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change CIDv1.encode() default encoding to base32 to conform with CID specification.
4 changes: 2 additions & 2 deletions tests/test_cid.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def test_buffer(self, cid):
assert buffer[1:] == multicodec.add_prefix(self.TEST_CODEC, cid.multihash)

def test_encode_default(self, cid):
"""#encode defaults to base58btc encoding"""
assert cid.encode() == b"zdj7WhuEjrB52m1BisYCtmjH1hSKa7yZ3jEZ9JcXaFRD51wVz"
"""#encode defaults to base32 encoding"""
assert cid.encode() == b"bafybeifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e"

@pytest.mark.parametrize("codec", ENCODINGS)
def test_encode_encoding(self, cid, codec):
Expand Down
Loading