mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
572498be56
It's the only location it's used, so we might as well move it there. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
16 lines
302 B
Go
16 lines
302 B
Go
package resolvconf
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
"io"
|
|
)
|
|
|
|
// hashData returns the sha256 sum of src.
|
|
func hashData(src io.Reader) (string, error) {
|
|
h := sha256.New()
|
|
if _, err := io.Copy(h, src); err != nil {
|
|
return "", err
|
|
}
|
|
return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil
|
|
}
|