chroe: change the hashing algo

This commit is contained in:
Sai Kumar 2022-06-03 19:36:06 +05:30
parent 808a7fe2b3
commit dde1038571

View File

@ -7,6 +7,7 @@ package utils
import ( import (
"bytes" "bytes"
"errors" "errors"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime/codec/dagcbor" "github.com/ipld/go-ipld-prime/codec/dagcbor"
"github.com/ipld/go-ipld-prime/fluent" "github.com/ipld/go-ipld-prime/fluent"
@ -83,8 +84,8 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ lp := cidlink.LinkPrototype{Prefix: cid.Prefix{
Version: 1, // Usually '1'. Version: 1, // Usually '1'.
Codec: 0x71, // 0x71 means "dag-cbor" -- See the multicodecs table: https://github.com/multiformats/multicodec/ Codec: 0x71, // 0x71 means "dag-cbor" -- See the multicodecs table: https://github.com/multiformats/multicodec/
MhType: 0x13, // 0x20 means "sha2-512" -- See the multicodecs table: https://github.com/multiformats/multicodec/ MhType: 0x12, // 0x12 means "sha2-256" -- See the multicodecs table: https://github.com/multiformats/multicodec/
MhLength: 64, // sha2-512 hash has a 64-byte sum. MhLength: 32, // sha2-256 hash has a 32-byte sum.
}} }}
// And we need some data to link to! Here's a quick piece of example data: // And we need some data to link to! Here's a quick piece of example data: