mirror of
https://github.com/rclone/rclone.git
synced 2025-06-21 04:08:02 +02:00
hash: add MultiHasher.Sum() to retrieve a single specific hash
This commit is contained in:
parent
ceeac84cfe
commit
2812816142
@ -238,6 +238,15 @@ func (m *MultiHasher) Sums() map[Type]string {
|
|||||||
return dst
|
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
|
// Size returns the number of bytes written
|
||||||
func (m *MultiHasher) Size() int64 {
|
func (m *MultiHasher) Size() int64 {
|
||||||
return m.size
|
return m.size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user