aboutsummaryrefslogtreecommitdiff
path: root/object/id/algorithm_new.go
blob: 8abbaeda8b74b858ea94545cc2f3f538a3c57ddd (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package objectid

import "hash"

// New returns a new hash.Hash for this algorithm.
func (algo Algorithm) New() (hash.Hash, error) {
	newFn := algo.info().new
	if newFn == nil {
		return nil, ErrInvalidAlgorithm
	}

	return newFn(), nil
}