func (a *Algorithm) Set(value string) error {
	if value == "" {
		*a = Canonical
	} else {
		*a = Algorithm(value)
	}
	return nil
}
Set implemented to allow use of Algorithm as a command line flag.
package digest
import (
	"crypto"
	"fmt"
	"hash"
	"io"
)
type Algorithm string
const (
	SHA256 Algorithm = "sha256"  
	SHA384 Algorithm = "sha384"  
	SHA512 Algorithm = "sha512"  
	Canonical = SHA256
)
var (
	algorithms = map[Algorithm]crypto.Hash{
		SHA256: crypto.SHA256,
		SHA384: crypto.SHA384,
		SHA512: crypto.SHA512,
	}
)
func (a Algorithm) Available() bool {
	h, ok := algorithms[a]
	if !ok {
		return false
	}
	return h.Available()
}
func (a Algorithm) String() string {
	return string(a)
}
func (a Algorithm) Size() int {
	h, ok := algorithms[a]
	if !ok {
		return 0
	}
	return h.Size()
}