So the first step is to extract the first byte and to get a representation in hexadecimal. Then we can match with the multibase table to determine which encoding is used (the 0x is an indication to tell us that the text is in base16 which is hexadecimal)
Given a CID the first step when decoding the CID is to determine which multibase is used see https://github.com/multiformats/multibase
The CID(v1) encode this information on the first byte (ie the first 8 bits), see https://github.com/multiformats/cid#decoding-algorithm where: