github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/resolvconf/utils.go (about) 1 package resolvconf 2 3 import ( 4 "crypto/sha256" 5 "encoding/hex" 6 "io" 7 ) 8 9 // hashData returns the sha256 sum of src. 10 func hashData(src io.Reader) (string, error) { 11 h := sha256.New() 12 if _, err := io.Copy(h, src); err != nil { 13 return "", err 14 } 15 return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil 16 }