multiformats/multihash

Question: trying to match hashes using sha256 (apparently I don't have sha2-256)

Closed this issue · 1 comments

Simple question. What is the unix command to create this hash from you example?

# sha2-256 0x12 - sha2-256("multihash")
12209cbc07c3f991725836a3aa2a581ca2029198aa420b9d99bc0e131d9f3e2cbe47 # sha2-256 in hex

I'm having trouble finding a match:

echo -n multihash | sha256sum 
9cbc07c3f991725836a3aa2a581ca2029198aa420b9d99bc0e131d9f3e2cbe47  -

Even the length is different. I assume sha256sum is not sha2 ?? The ultimate goal is to hash in JavaScript and match an IPFS link. Thank you..

nevermind, I see it .. your just adding the multihash prefix.. thanks.