From 706f7a05b9a4ed464f693941235aa7e9ca14145a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 4 May 2023 04:14:47 -0400 Subject: [PATCH] feat: add cid package --- cid/cid.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 cid/cid.go diff --git a/cid/cid.go b/cid/cid.go new file mode 100644 index 0000000..2fb1666 --- /dev/null +++ b/cid/cid.go @@ -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) +}