aboutsummaryrefslogtreecommitdiff
path: root/object/id/algorithm_details.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-05-15 17:51:47 +0000
committerGravatar Runxi Yu2026-05-15 17:51:47 +0000
commit189aa75333453434fc4b2f1f71dcce89cfba1fcb (patch)
treec2b7dec0777a68876857b525fc44e23fd2219d45 /object/id/algorithm_details.go
parentobject/typ: Don't mirror packfiles (diff)
signatureNo signature
obejct/id: Remove pack/signature/etc-specific object ID properties
These properties should belong to their relevant package rather than getting stuffed into object/id.
Diffstat (limited to 'object/id/algorithm_details.go')
-rw-r--r--object/id/algorithm_details.go16
1 files changed, 0 insertions, 16 deletions
diff --git a/object/id/algorithm_details.go b/object/id/algorithm_details.go
index 23737ab5..883853c7 100644
--- a/object/id/algorithm_details.go
+++ b/object/id/algorithm_details.go
@@ -9,11 +9,8 @@ import (
type algorithmDetails struct {
name string
size int
- packHashID uint32
- signatureHeaderName string
sum func([]byte) ObjectID
new func() hash.Hash
- emptyTree ObjectID
}
func (algo Algorithm) details() algorithmDetails {
@@ -26,8 +23,6 @@ var algorithmTable = [...]algorithmDetails{
AlgorithmSHA1: {
name: "sha1",
size: sha1.Size,
- packHashID: 1,
- signatureHeaderName: "gpgsig",
sum: func(data []byte) ObjectID {
sum := sha1.Sum(data) //#nosec G401
@@ -38,13 +33,10 @@ var algorithmTable = [...]algorithmDetails{
return id
},
new: sha1.New,
- emptyTree: ObjectID{}, //nolint:exhaustruct
},
AlgorithmSHA256: {
name: "sha256",
size: sha256.Size,
- packHashID: 2,
- signatureHeaderName: "gpgsig-sha256",
sum: func(data []byte) ObjectID {
sum := sha256.Sum256(data)
@@ -55,7 +47,6 @@ var algorithmTable = [...]algorithmDetails{
return id
},
new: sha256.New,
- emptyTree: ObjectID{}, //nolint:exhaustruct
},
}
@@ -75,14 +66,7 @@ func init() { //nolint:gochecknoinits
// Skip over AlgorithmUnknown.
for algo := Algorithm(1); int(algo) < len(algorithmTable); algo++ {
info := &algorithmTable[algo]
-
- info.emptyTree = info.sum([]byte("tree 0\x00"))
-
algorithmByName[info.name] = algo
- if info.signatureHeaderName != "" {
- algorithmBySignatureHeaderName[info.signatureHeaderName] = algo
- }
-
supportedAlgorithms = append(supportedAlgorithms, algo)
}
}