b7daa2f3a4
Update traefik dependencies (docker/docker and related) - Update dependencies - Fix compilation problems - Remove vdemeester/docker-events (in docker api now) - Remove `integration/vendor` - Use `testImport` - update some deps. - regenerate the lock from scratch (after a `glide cc`)
25 lines
586 B
Go
25 lines
586 B
Go
package digest
|
|
|
|
import "hash"
|
|
|
|
// Digester calculates the digest of written data. Writes should go directly
|
|
// to the return value of Hash, while calling Digest will return the current
|
|
// value of the digest.
|
|
type Digester interface {
|
|
Hash() hash.Hash // provides direct access to underlying hash instance.
|
|
Digest() Digest
|
|
}
|
|
|
|
// digester provides a simple digester definition that embeds a hasher.
|
|
type digester struct {
|
|
alg Algorithm
|
|
hash hash.Hash
|
|
}
|
|
|
|
func (d *digester) Hash() hash.Hash {
|
|
return d.hash
|
|
}
|
|
|
|
func (d *digester) Digest() Digest {
|
|
return NewDigest(d.alg, d.hash)
|
|
}
|