-
Notifications
You must be signed in to change notification settings - Fork 57
/
registry.go
31 lines (25 loc) · 1.08 KB
/
registry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package multihash
import (
"hash"
mhreg "github.com/multiformats/go-multihash/core"
_ "github.com/multiformats/go-multihash/register/all"
_ "github.com/multiformats/go-multihash/register/sha256"
)
// Register is an alias for Register in the core package.
//
// Consider using the core package instead of this multihash package;
// that package does not introduce transitive dependencies except for those you opt into,
// and will can result in smaller application builds.
func Register(indicator uint64, hasherFactory func() hash.Hash) {
mhreg.Register(indicator, hasherFactory)
}
// GetHasher is an alias for GetHasher in the core package.
//
// Consider using the core package instead of this multihash package;
// that package does not introduce transitive dependencies except for those you opt into,
// and will can result in smaller application builds.
func GetHasher(indicator uint64) (hash.Hash, error) {
return mhreg.GetHasher(indicator)
}
// DefaultLengths maps a multihash indicator code to the output size for that hash, in units of bytes.
var DefaultLengths = mhreg.DefaultLengths