diff options
| author | 2026-03-29 16:07:21 +0000 | |
|---|---|---|
| committer | 2026-03-29 16:07:21 +0000 | |
| commit | 256d945a109f8d6bf6a13d0e9a93545b64680ba8 (patch) | |
| tree | 6d59a1bf77bf6da206172a9a41208a0e1df0e042 /object/id/algorithm_tables.go | |
| parent | *: Audit labels (diff) | |
| signature | No signature | |
object/id: Add support for signature headers v0.1.148
Diffstat (limited to 'object/id/algorithm_tables.go')
| -rw-r--r-- | object/id/algorithm_tables.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/object/id/algorithm_tables.go b/object/id/algorithm_tables.go index 2ea85879..92b77de0 100644 --- a/object/id/algorithm_tables.go +++ b/object/id/algorithm_tables.go @@ -9,9 +9,10 @@ import ( var algorithmTable = [...]algorithmDetails{ AlgorithmUnknown: {}, AlgorithmSHA1: { - name: "sha1", - size: sha1.Size, - packHashID: 1, + name: "sha1", + size: sha1.Size, + packHashID: 1, + signatureHeaderName: "gpgsig", sum: func(data []byte) ObjectID { sum := sha1.Sum(data) //#nosec G401 @@ -24,9 +25,10 @@ var algorithmTable = [...]algorithmDetails{ new: sha1.New, }, AlgorithmSHA256: { - name: "sha256", - size: sha256.Size, - packHashID: 2, + name: "sha256", + size: sha256.Size, + packHashID: 2, + signatureHeaderName: "gpgsig-sha256", sum: func(data []byte) ObjectID { sum := sha256.Sum256(data) @@ -44,6 +46,8 @@ var ( //nolint:gochecknoglobals algorithmByName = map[string]Algorithm{} //nolint:gochecknoglobals + algorithmBySignatureHeaderName = map[string]Algorithm{} + //nolint:gochecknoglobals supportedAlgorithms []Algorithm ) @@ -58,6 +62,9 @@ func init() { //nolint:gochecknoinits info.emptyTree = info.sum(emptyTreeInput) algorithmByName[info.name] = algo + if info.signatureHeaderName != "" { + algorithmBySignatureHeaderName[info.signatureHeaderName] = algo + } supportedAlgorithms = append(supportedAlgorithms, algo) } } |
