mirror of
https://github.com/rclone/rclone.git
synced 2025-01-05 05:49:33 +01:00
hash: add MultiHasher.Sum() to retrieve a single specific hash
This commit is contained in:
parent
ebf671bf3e
commit
5da98499ed
@ -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 New Issue
Block a user