Skip to content

Commit 1e874e7

Browse files
authored
More multiformat enum values (#36)
Signed-off-by: turuslan <[email protected]>
1 parent f3aa294 commit 1e874e7

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

include/libp2p/multi/hash_type.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace libp2p::multi {
1717
sha1 = 0x11,
1818
sha256 = 0x12,
1919
sha512 = 0x13,
20+
blake2b_256 = 0xb220,
2021
blake2s128 = 0xb250,
2122
blake2s256 = 0xb260
2223
};

include/libp2p/multi/multicodec_type.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ namespace libp2p::multi {
3030
SHA3_384 = 0x15,
3131
SHA3_256 = 0x16,
3232
SHA3_224 = 0x17,
33-
DAG_PB = 0x70
33+
RAW = 0x55,
34+
DAG_PB = 0x70,
35+
DAG_CBOR = 0x71,
3436
};
3537

3638
static std::string getName(Code code) {
3739
switch (code) {
3840
case Code::IDENTITY:
39-
return "raw";
41+
return "identity";
4042
case Code::SHA1:
4143
return "sha1";
4244
case Code::SHA2_256:
@@ -51,8 +53,12 @@ namespace libp2p::multi {
5153
return "sha3-384";
5254
case Code::SHA3_512:
5355
return "sha3-512";
56+
case Code::RAW:
57+
return "raw";
5458
case Code::DAG_PB:
5559
return "dag-pb";
60+
case Code::DAG_CBOR:
61+
return "dag-cbor";
5662
}
5763
return "unknown";
5864
}

test/libp2p/multi/cid_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TEST(CidTest, PrettyString) {
3434
ContentIdentifier c1(ContentIdentifier::Version::V1, MulticodecType::IDENTITY,
3535
ZERO_MULTIHASH);
3636
ASSERT_EQ(c1.toPrettyString("base58"),
37-
"base58 - cidv1 - raw - sha2-256-256-"
37+
"base58 - cidv1 - identity - sha2-256-256-"
3838
+ libp2p::common::hex_lower(ZERO_MULTIHASH.getHash()));
3939
ContentIdentifier c2(ContentIdentifier::Version::V0, MulticodecType::DAG_PB,
4040
EXAMPLE_MULTIHASH);

0 commit comments

Comments
 (0)