aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2022-11-29 07:02:11 +0100
committerGitHub <noreply@github.com>2022-11-29 07:02:11 +0100
commit0966a009e12e0ebd5a84a181422c63c97929739a (patch)
treea8d7351b3d6094cea5974750a312346f1c066e0a /plumbing/format/packfile
parentc798d4a42004b1c8976a6a4f42f131f16d08b6fa (diff)
parent7c37589e95f6a88e470bf91d3a0ef8536702f3f4 (diff)
downloadgo-git-0966a009e12e0ebd5a84a181422c63c97929739a.tar.gz
Merge pull request #618 from fluxcd/collision_detection
sha1: Add collision resistent implementation
Diffstat (limited to 'plumbing/format/packfile')
-rw-r--r--plumbing/format/packfile/encoder.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/plumbing/format/packfile/encoder.go b/plumbing/format/packfile/encoder.go
index 5501f88..a8a7e96 100644
--- a/plumbing/format/packfile/encoder.go
+++ b/plumbing/format/packfile/encoder.go
@@ -2,11 +2,12 @@ package packfile
import (
"compress/zlib"
- "crypto/sha1"
+ "crypto"
"fmt"
"io"
"github.com/go-git/go-git/v5/plumbing"
+ "github.com/go-git/go-git/v5/plumbing/hash"
"github.com/go-git/go-git/v5/plumbing/storer"
"github.com/go-git/go-git/v5/utils/binary"
"github.com/go-git/go-git/v5/utils/ioutil"
@@ -28,7 +29,7 @@ type Encoder struct {
// OFSDeltaObject. To use Reference deltas, set useRefDeltas to true.
func NewEncoder(w io.Writer, s storer.EncodedObjectStorer, useRefDeltas bool) *Encoder {
h := plumbing.Hasher{
- Hash: sha1.New(),
+ Hash: hash.New(crypto.SHA1),
}
mw := io.MultiWriter(w, h)
ow := newOffsetWriter(mw)