Skip to content

Commit 0d671fc

Browse files
committed
govc: sha256 for session cache
Use sha256 for session cache file names This maintains compatibility between govc and Terraform, allowing the two to share the same cache while also ensureing SHA1 is eliminated. Signed-off-by: Ryan Johnson <[email protected]>
1 parent a7d6f3a commit 0d671fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

session/cache/session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package cache
1818

1919
import (
2020
"context"
21-
"crypto/sha1"
21+
"crypto/sha256"
2222
"encoding/json"
2323
"fmt"
2424
"net/url"
@@ -105,7 +105,7 @@ func (s *Session) key(path string) string {
105105
// Key session file off of full URI and insecure setting.
106106
// Hash key to get a predictable, canonical format.
107107
key := fmt.Sprintf("%s#insecure=%t", p.String(), s.Insecure)
108-
return fmt.Sprintf("%040x", sha1.Sum([]byte(key)))
108+
return fmt.Sprintf("%064x", sha256.Sum256([]byte(key)))
109109
}
110110

111111
func (s *Session) file(p string) string {

0 commit comments

Comments
 (0)