func FromBytes(p []byte) Digest {
	digester := Canonical.New()
	if _, err := digester.Hash().Write(p); err != nil {
		panic("write to hash function returned error: " + err.Error())
	}
	return digester.Digest()
}
FromBytes digests the input and returns a Digest.
package digest
import (
	"fmt"
	"hash"
	"io"
	"regexp"
	"strings"
)
const (
	DigestSha256EmptyTar = "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
)
type Digest string
func NewDigest(alg Algorithm, h hash.Hash) Digest {
	return Digest(fmt.Sprintf("%s:%x", alg, h.Sum(nil)))
}
func NewDigestFromHex(alg, hex string) Digest {
	return Digest(fmt.Sprintf("%s:%s", alg, hex))
}
var DigestRegexp = regexp.MustCompile(`[a-zA-Z0-9-_+.]+:[a-fA-F0-9]+`)
var DigestRegexpAnchored = regexp.MustCompile(`^` + DigestRegexp.String() + `$`)
var (
	ErrDigestInvalidFormat = fmt.Errorf("invalid checksum digest format")
	ErrDigestInvalidLength = fmt.Errorf("invalid checksum digest length")
	ErrDigestUnsupported = fmt.Errorf("unsupported digest algorithm")
)
func ParseDigest(s string) (Digest, error) {
	d := Digest(s)
	return d, d.Validate()
}
func FromReader(rd io.Reader) (Digest, error) {
	return Canonical.FromReader(rd)
}