feat: add StringHash

This commit is contained in:
Derrick Hammer 2023-05-10 14:36:45 -04:00
parent a93add8f70
commit 118c679f76
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -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)