Hi! Im trying to reproduce IPFS hash using js-multihash (https://github.com/multiformats/js-multihash). From my understanding IPFS hash basically take the input of file that has been hashed with sha2-256 (or other algorithm), add some identifier and base58 the result.
I try to do that using js-multihash but the result was different than when I use ipfs add -n.
So is there any steps that I miss?
If you’re trying to reverse-engineer what ipfs add -n does, I’d suggest taking a look at what ipfs.files.add does in js-ipfs when using the onlyHash option.
Curious, is there a reason you can’t use the existing js-ipfs ipfs.files.add API?
At the very least, this is omitting the step where files are chunked and split into a merkledag structure.
Im not using js-ipfs because the program that I develop is used by client, so i think when using js-ipfs the client needed to download the IPFS which increase the app size quite big.
Edit:
So I found out js dag generation for IPFS (https://github.com/ipld/js-ipld-dag-pb) but still the result of DAGNode.create doesnt match the result of ipfs add -n. Any suggestions?