aboutsummaryrefslogtreecommitdiff
path: root/packed_write_pack.go
diff options
context:
space:
mode:
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