Multihash hashing function name as a param for ipfs.files.add?
aleybovich opened this issue · comments
What is the expected hashing function value/name that I can pass as a paremeter to ipfs.files.add?
As in ipfs.files.add(Buffer.from("some text"), { hash: "?????" })
I tried sha256
but I get an error unrecognized hash function: sha256
@aleybovich they're here: https://github.com/multiformats/js-multihash/blob/master/src/constants.js#L5-L343
I'd appreciate it if you had time to send a PR to update the docs for files.add
to reference it.
Thank you for your response @alanshaw, how would you suggest I reference these constants in the PR?
Also, which of them is the default hash function that's used by the ipfs? Is that sha3-256?
Just a link like I posted is fine. I believe the default is sha2-256
(https://github.com/ipfs/js-ipfs-unixfs-engine/blob/master/src/importer/index.js#L20) - would be good to have that information included as well.