Hash 32 or 33 bytes?

I am trying decode the ipfs file hash (base58 of sha256) to UTF8 binary. I need transform back into 32 bytes.

I am using this js Code


I remove the first 2 bytes from hash (Qm) and try to decode the rest. But it returns me 33 bytes!!!
You can check also as hex

You need to decode the base58 first. The decoded bytes don’t map one-to-one to the characters in encoded string.

Note: Don’t rely on the “hash” having this format. CIDv1 (the next-gen CID format):

  1. Allows arbitrary (safe) hash functions).
  2. Has a slightly different format.

I decoded the base58 to hex first. So I ignored the first 2 bytes (Qm) in hex .

If ignore the 2 bytes before and decode to hex after, will not works when encode to base58 again.