~tsileo/blobstash

ref: b178995e346d blobstash/pkg/hashutil/hashutil.go -rw-r--r-- 366 bytes
b178995eThomas Sileo vendor: update deps 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package hashutil // import "a4.io/blobstash/pkg/hashutil"

import (
	"fmt"

	"golang.org/x/crypto/blake2b"
)

// ComputeRaw returns the Blake2B hash hex-encoded
func ComputeRaw(data []byte) [32]byte {
	return blake2b.Sum256(data)
}

// Compute returns the Blake2B hash hex-encoded
func Compute(data []byte) string {
	return fmt.Sprintf("%x", blake2b.Sum256(data))
}