feat: add StringHash
This commit is contained in:
parent
a93add8f70
commit
118c679f76
|
@ -15,6 +15,10 @@ type CID struct {
|
||||||
Size uint64
|
Size uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c CID) StringHash() string {
|
||||||
|
return hex.EncodeToString(c.Hash[:])
|
||||||
|
}
|
||||||
|
|
||||||
func Encode(hash []byte, size uint64) (string, error) {
|
func Encode(hash []byte, size uint64) (string, error) {
|
||||||
var hashBytes [32]byte
|
var hashBytes [32]byte
|
||||||
copy(hashBytes[:], hash)
|
copy(hashBytes[:], hash)
|
||||||
|
|
Loading…
Reference in New Issue