feat: add cid package

This commit is contained in:
Derrick Hammer 2023-05-04 04:14:47 -04:00
parent 13d1adb717
commit 706f7a05b9
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 0 deletions

11
cid/cid.go Normal file
View File

@ -0,0 +1,11 @@
package cid
import (
"github.com/multiformats/go-multibase"
)
func EncodeHashSimple(hash [32]byte) (string, error) {
prefixedHash := append([]byte{0x26, 0x1f}, hash[:]...)
return multibase.Encode(multibase.Base58BTC, prefixedHash)
}