github.com/pachyderm/pachyderm@v1.13.4/src/server/pkg/storage/hash/hash.go (about)

     1  package hash
     2  
     3  import (
     4  	"crypto/sha512"
     5  	"encoding/hex"
     6  	"hash"
     7  )
     8  
     9  // New creates a new hasher.
    10  func New() hash.Hash {
    11  	return sha512.New()
    12  }
    13  
    14  // Sum computes a hash sum for a set of bytes.
    15  func Sum(data []byte) []byte {
    16  	sum := sha512.Sum512(data)
    17  	return sum[:]
    18  }
    19  
    20  // EncodeHash encodes a hash into a string representation.
    21  func EncodeHash(bytes []byte) string {
    22  	return hex.EncodeToString(bytes)
    23  }