utils.go 274 B

1234567891011121314
  1. package resolvconf
  2. import (
  3. "crypto/sha256"
  4. "encoding/hex"
  5. )
  6. // hashData returns the sha256 sum of data.
  7. func hashData(data []byte) []byte {
  8. f := sha256.Sum256(data)
  9. out := make([]byte, 2*sha256.Size)
  10. hex.Encode(out, f[:])
  11. return append([]byte("sha256:"), out...)
  12. }