0

I have read this stackoverflow post: How to create an IPFS compatible multihash

$ echo "Hello World" | ipfs add -n
$ added QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u

base58

12 - 20 - 74410577111096cd817a3faed78630f2245636beded412d3b212a2e09ba593ca
<hash-type> - <hash-length> - <hash-digest>

ipfs cat

$ curl "https://ipfs.infura.io:5001/api/v0/object/data?arg=QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u"

Hello World

So I was wondering how does ipfs's decoding work?

Since as far as I know, sha-256 hash function is ONE-WAY hashing, right?

user76333
  • 153
  • 1
  • 13

1 Answers1

2

Basicly, IPFS is a (key, value) storage service. The multihash you get from ipfs add command is the multihash of the value, also the key to retrieve the value from IPFS service with ipfs get or ipfs object commands.

With http api of IPFS service, curl "https://ipfs.infura.io:5001/api/v0/object/data?arg=key works exactly same as ipfs object data command.

So it is not about decoding the hash, it is just get the value with you key(the multihash).