Documentation ¶
Index ¶
Constants ¶
View Source
const ( SHA1 = 0x11 SHA2_256 = 0x12 SHA2_512 = 0x13 SHA3 = 0x14 BLAKE2B = 0x40 BLAKE2S = 0x41 )
constants
Variables ¶
View Source
var ( ErrUnknownCode = errors.New("unknown multihash code") ErrTooShort = errors.New("multihash too short. must be > 3 bytes") ErrTooLong = errors.New("multihash too long. must be < 129 bytes") ErrLenNotSupported = errors.New("multihash does not yet support digests longer than 127 bytes") )
errors
View Source
var Codes = map[int]string{ SHA1: "sha1", SHA2_256: "sha2-256", SHA2_512: "sha2-512", SHA3: "sha3", BLAKE2B: "blake2b", BLAKE2S: "blake2s", }
Codes maps a hash code to it's name
View Source
var DefaultLengths = map[int]int{ SHA1: 20, SHA2_256: 32, SHA2_512: 64, SHA3: 64, BLAKE2B: 64, BLAKE2S: 32, }
DefaultLengths maps a hash code to it's default length
View Source
var ErrSumNotSupported = errors.New("Function not implemented. Complain to lib maintainer.")
View Source
var Names = map[string]int{ "sha1": SHA1, "sha2-256": SHA2_256, "sha2-512": SHA2_512, "sha3": SHA3, "blake2b": BLAKE2B, "blake2s": BLAKE2S, }
Names maps the name of a hash to the code
Functions ¶
Types ¶
type DecodedMultihash ¶
func Decode ¶
func Decode(buf []byte) (*DecodedMultihash, error)
Decode a hash from the given Multihash.
type ErrInconsistentLen ¶
type ErrInconsistentLen struct {
// contains filtered or unexported fields
}
ErrInconsistentLen is returned when a decoded multihash has an inconsistent length
func (ErrInconsistentLen) Error ¶
func (e ErrInconsistentLen) Error() string
Click to show internal directories.
Click to hide internal directories.