aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/hash/hash.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-02-25 13:32:17 +0000
committerPaulo Gomes <pjbgf@linux.com>2023-02-25 13:32:17 +0000
commitbd33c95fc3cbe8c04dd084c22defd1aa3c3e43dc (patch)
tree1d14ac51034f021469322a0ea03ea20657f7df2d /plumbing/hash/hash.go
parent7ab4957732a817bada223e5c361f0c9753d9e40c (diff)
downloadgo-git-bd33c95fc3cbe8c04dd084c22defd1aa3c3e43dc.tar.gz
Remove need to build with CGO
Follow-up from #618, at the time the Pure Go sha1cd implementation was not performant enough to be the default. This has now changed and the cgo and generic implementations yields similar results. Users are able to override the default implementation, however this seems to be a better default as it does not require the use of CGO during build time. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
Diffstat (limited to 'plumbing/hash/hash.go')
-rw-r--r--plumbing/hash/hash.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/plumbing/hash/hash.go b/plumbing/hash/hash.go
index fe3bf76..80e4b5f 100644
--- a/plumbing/hash/hash.go
+++ b/plumbing/hash/hash.go
@@ -7,7 +7,7 @@ import (
"fmt"
"hash"
- "github.com/pjbgf/sha1cd/cgo"
+ "github.com/pjbgf/sha1cd"
)
// algos is a map of hash algorithms.
@@ -20,9 +20,7 @@ func init() {
// reset resets the default algos value. Can be used after running tests
// that registers new algorithms to avoid side effects.
func reset() {
- // For performance reasons the cgo version of the collision
- // detection algorithm is being used.
- algos[crypto.SHA1] = cgo.New
+ algos[crypto.SHA1] = sha1cd.New
}
// RegisterHash allows for the hash algorithm used to be overriden.