Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>
"crypto/sha1"
"errors"
"fmt"
+ "io"
"regexp"
"strings"
)
secret := parts[2]
if len(secret) != 40 {
// not already salted
- secret = fmt.Sprintf("%x", hmac.New(sha1.New, []byte(secret)).Sum([]byte(remote)))
+ hmac := hmac.New(sha1.New, []byte(secret))
+ io.WriteString(hmac, remote)
+ secret = fmt.Sprintf("%x", hmac.Sum(nil))
return "v2/" + uuid + "/" + secret, nil
} else if strings.HasPrefix(uuid, remote) {
// already salted for the desired remote