Conditions | 1 |
Total Lines | 10 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | """Python implementation of EIP 1577 content hash.""" |
||
34 | def get_codec(chash: str) -> str: |
||
35 | """ |
||
36 | Extract the codec of a content hash |
||
37 | |||
38 | :param hash: a hex string containing a content hash |
||
39 | |||
40 | :return: the extracted codec |
||
41 | """ |
||
42 | codec, _ = multicodec.unwrap(bytes.fromhex(chash.lstrip('0x'))) |
||
43 | return codec.name |
||
44 |