cid

package
v0.1.0-develop.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingEmptySize = errors.New("Missing or empty size")
	ErrInvalidCIDMagic  = errors.New("CID magic bytes missing or invalid")
)
View Source
var MAGIC_BYTES = []byte{0x26, 0x1f}

Functions

func Encode

func Encode(hash []byte, size uint64) (string, error)

func EncodeFixed

func EncodeFixed(hash [32]byte, size uint64) (string, error)

func EncodeString

func EncodeString(hash string, size uint64) (string, error)

func Valid

func Valid(cid string) (bool, error)

Types

type CID

type CID struct {
	Hash [32]byte
	Size uint64
}

func Decode

func Decode(cid string) (*CID, error)

func (CID) StringHash

func (c CID) StringHash() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL