aboutsummaryrefslogtreecommitdiff
path: root/packed_write_pack.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-01-29 21:17:25 +0100
committerGravatar Runxi Yu2026-01-29 21:18:05 +0100
commit7644a12dd8fbeb0c936848a4bc5cef423a8fc2b7 (patch)
tree75db96d1d24f178be68907577897614cb855d09b /packed_write_pack.go
parentmurmurhash2: Delete (diff)
signatureNo signature
hash: Make streaming hashes possible
Diffstat (limited to 'packed_write_pack.go')
-rw-r--r--packed_write_pack.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/packed_write_pack.go b/packed_write_pack.go
index aa5b7aa0..7e79b2ef 100644
--- a/packed_write_pack.go
+++ b/packed_write_pack.go
@@ -2,8 +2,6 @@ package furgit
import (
"crypto/rand"
- "crypto/sha1"
- "crypto/sha256"
"encoding/binary"
"errors"
"hash"
@@ -29,7 +27,7 @@ func newPackWriter(w io.Writer, algo hashAlgorithm, objCount uint32) (*packWrite
if w == nil {
return nil, ErrInvalidObject
}
- h, err := newHashWriter(algo)
+ h, err := algo.New()
if err != nil {
return nil, err
}
@@ -41,17 +39,6 @@ func newPackWriter(w io.Writer, algo hashAlgorithm, objCount uint32) (*packWrite
}, nil
}
-func newHashWriter(algo hashAlgorithm) (hash.Hash, error) {
- switch algo {
- case hashAlgoSHA1:
- return sha1.New(), nil
- case hashAlgoSHA256:
- return sha256.New(), nil
- default:
- return nil, ErrInvalidObject
- }
-}
-
func (pw *packWriter) writePacked(p []byte) error {
if len(p) == 0 {
return nil