vendor: update resumable dependency

Updates resumable hash implementation to Go 1.8 equivalent. This should
be a major speedup, since it includes a number of optimizations from Go
1.7.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-03-02 13:39:41 -08:00
parent 83f857ca12
commit f01bcc8f62
No known key found for this signature in database
GPG key ID: 67B3DED84EDC823F
19 changed files with 1118 additions and 98 deletions

View file

@ -2,8 +2,11 @@ package sha512
import (
"bytes"
"crypto"
"encoding/gob"
"github.com/stevvooe/resumable"
// import to ensure that our init function runs after the standard package
_ "crypto/sha512"
)
@ -21,7 +24,7 @@ func (d *digest) State() ([]byte, error) {
// We encode this way so that we do not have
// to export these fields of the digest struct.
vals := []interface{}{
d.h, d.x, d.nx, d.len, d.is384,
d.h, d.x, d.nx, d.len, d.function,
}
for _, val := range vals {
@ -40,7 +43,7 @@ func (d *digest) Restore(state []byte) error {
// We decode this way so that we do not have
// to export these fields of the digest struct.
vals := []interface{}{
&d.h, &d.x, &d.nx, &d.len, &d.is384,
&d.h, &d.x, &d.nx, &d.len, &d.function,
}
for _, val := range vals {
@ -49,5 +52,12 @@ func (d *digest) Restore(state []byte) error {
}
}
switch d.function {
case crypto.SHA384, crypto.SHA512, crypto.SHA512_224, crypto.SHA512_256:
break
default:
return resumable.ErrBadState
}
return nil
}