I don't have any background with this subject.
To try to understand them better, I read:
From what I understand, the multihash
is the algorithm used to hash (one way) the value. so it means, we can't go back (we can't decode the hash to the value).
multicodec
and if it's related to decoding the hash to a value (which makes no sense).multicodec
prefix?The multicodec
is related to decoding the value the hash points to, if that makes it easier to understand. Don't worry, no magic hash decoding is happening ;). Remember we're making CIDs, and we can use CIDs to lookup content. However then we have the question of "how do we decode this data we just retrieved?", the multicodec
solves that problem for us. Reading From Data to Data Structures might help clear up some confusion.
The multicodec
prefix allows IPFS to evolve to support new and different encodings for the data that's actually put into IPFS. This refers to IPLD, and you can actually find the answer you're looking for under Links (with information about the codecs under Codecs):
For links we use a CID. A CID is an extension of
multihash
, in fact amultihash
is part of aCID
. We simply add a codec to amultihash
that tells us what format the data is in (JSON, CBOR, Bitcoin, Ethereum, etc). This way, we can actually link between data in different formats and any link to data anyone ever gives us can be decoded so that it can become more than just a series of bytes.CID is a standard that anyone can implement, even people that have no other interest in IPLD beyond the need for hash links to different data types can use it.