multicodec_codes.py only defines 6 hash codes (identity, sha2-256, sha2-512, sha3-256, sha3-512, blake2b-256). Many commonly used hash functions are missing (shake-128, shake-256, keccak-, blake3, blake2s-, murmur3-*, etc.).
Problem
In dag/multicodec_codes.py:
SHA2_256_CODE = 0x12
SHA2_512_CODE = 0x13
SHA3_256_CODE = 0x16
SHA3_512_CODE = 0x17
BLAKE2B_256_CODE = 0xB220
IDENTITY_CODE = 0x00
Missing codes include:
shake-128 (0x18), shake-256 (0x19)
keccak-224 (0x1A), keccak-256 (0x1B), keccak-384 (0x1C), keccak-512 (0x1D)
blake3 (0x1E)
dbl-sha2-256 (0x56)
sha2-224 (0x1013), sha2-384 (0x20)
blake2b-8 through blake2b-512 (0xB201–0xB240)
blake2s-8 through blake2s-256 (0xB241–0xB260)
- And many more...
Proposed Solution
Add all hash codes from the multicodec table. Consider importing from py-multihash constants instead of duplicating:
# Option 1: Import from py-multihash
from multihash.constants import HASH_CODES
# Option 2: Add missing codes manually
SHAKE_128_CODE = 0x18
SHAKE_256_CODE = 0x19
KECCAK_224_CODE = 0x1A
KECCAK_256_CODE = 0x1B
KECCAK_384_CODE = 0x1C
KECCAK_512_CODE = 0x1D
BLAKE3_CODE = 0x1E
# ... etc
Related
multicodec_codes.pyonly defines 6 hash codes (identity, sha2-256, sha2-512, sha3-256, sha3-512, blake2b-256). Many commonly used hash functions are missing (shake-128, shake-256, keccak-, blake3, blake2s-, murmur3-*, etc.).Problem
In
dag/multicodec_codes.py:Missing codes include:
shake-128(0x18),shake-256(0x19)keccak-224(0x1A),keccak-256(0x1B),keccak-384(0x1C),keccak-512(0x1D)blake3(0x1E)dbl-sha2-256(0x56)sha2-224(0x1013),sha2-384(0x20)blake2b-8throughblake2b-512(0xB201–0xB240)blake2s-8throughblake2s-256(0xB241–0xB260)Proposed Solution
Add all hash codes from the multicodec table. Consider importing from
py-multihashconstants instead of duplicating:Related
dag/multicodec_codes.py