forked from TrueCloudLab/rclone
hash: add MultiHasher.Sum() to retrieve a single specific hash
This commit is contained in:
parent
ceeac84cfe
commit
2812816142
1 changed files with 9 additions and 0 deletions
|
@ -238,6 +238,15 @@ func (m *MultiHasher) Sums() map[Type]string {
|
|||
return dst
|
||||
}
|
||||
|
||||
// Sum returns the specified hash from the multihasher
|
||||
func (m *MultiHasher) Sum(hashType Type) ([]byte, error) {
|
||||
h, ok := m.h[hashType]
|
||||
if !ok {
|
||||
return nil, ErrUnsupported
|
||||
}
|
||||
return h.Sum(nil), nil
|
||||
}
|
||||
|
||||
// Size returns the number of bytes written
|
||||
func (m *MultiHasher) Size() int64 {
|
||||
return m.size
|
||||
|
|
Loading…
Reference in a new issue