aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/hash/hash.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-04-11 21:00:47 +0100
committerGitHub <noreply@github.com>2023-04-11 21:00:47 +0100
commitd5b1afd3cc786e56a90cec910b79815ed3b23cc7 (patch)
tree4e0b93ea480fdea37761d2e879a073ce6f5c1747 /plumbing/hash/hash.go
parentce62f3e9ff86270538a514a68d3bd5563a733e3b (diff)
parent8e8281008ee98e9864fa9597be3e16aaecdf9891 (diff)
downloadgo-git-d5b1afd3cc786e56a90cec910b79815ed3b23cc7.tar.gz
Merge pull request #707 from pjbgf/experimental-sha256
*: Add support for initializing SHA256 repositories
Diffstat (limited to 'plumbing/hash/hash.go')
-rw-r--r--plumbing/hash/hash.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/plumbing/hash/hash.go b/plumbing/hash/hash.go
index 80e4b5f..82d1856 100644
--- a/plumbing/hash/hash.go
+++ b/plumbing/hash/hash.go
@@ -21,6 +21,7 @@ func init() {
// that registers new algorithms to avoid side effects.
func reset() {
algos[crypto.SHA1] = sha1cd.New
+ algos[crypto.SHA256] = crypto.SHA256.New
}
// RegisterHash allows for the hash algorithm used to be overriden.
@@ -34,6 +35,8 @@ func RegisterHash(h crypto.Hash, f func() hash.Hash) error {
switch h {
case crypto.SHA1:
algos[h] = f
+ case crypto.SHA256:
+ algos[h] = f
default:
return fmt.Errorf("unsupported hash function: %v", h)
}