From a041d523de389b65b98a5373a8034041db2a8d83 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 2 Apr 2026 06:23:30 +0000 Subject: *: Remove --- object/id/algorithm_tables.go | 72 ------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 object/id/algorithm_tables.go (limited to 'object/id/algorithm_tables.go') diff --git a/object/id/algorithm_tables.go b/object/id/algorithm_tables.go deleted file mode 100644 index e4ec3257..00000000 --- a/object/id/algorithm_tables.go +++ /dev/null @@ -1,72 +0,0 @@ -package objectid - -import ( - "crypto/sha1" //#nosec:G505 - "crypto/sha256" -) - -//nolint:gochecknoglobals -var algorithmTable = [...]algorithmDetails{ - AlgorithmUnknown: {}, - AlgorithmSHA1: { - name: "sha1", - size: sha1.Size, - packHashID: 1, - signatureHeaderName: "gpgsig", - sum: func(data []byte) ObjectID { - sum := sha1.Sum(data) //#nosec G401 - - var id ObjectID - copy(id.data[:], sum[:]) - id.algo = AlgorithmSHA1 - - return id - }, - new: sha1.New, - }, - AlgorithmSHA256: { - name: "sha256", - size: sha256.Size, - packHashID: 2, - signatureHeaderName: "gpgsig-sha256", - sum: func(data []byte) ObjectID { - sum := sha256.Sum256(data) - - var id ObjectID - copy(id.data[:], sum[:]) - id.algo = AlgorithmSHA256 - - return id - }, - new: sha256.New, - }, -} - -var ( - //nolint:gochecknoglobals - algorithmByName = map[string]Algorithm{} - //nolint:gochecknoglobals - algorithmBySignatureHeaderName = map[string]Algorithm{} - //nolint:gochecknoglobals - supportedAlgorithms []Algorithm -) - -func init() { //nolint:gochecknoinits - emptyTreeInput := []byte("tree 0\x00") - - for algo := Algorithm(0); int(algo) < len(algorithmTable); algo++ { - info := &algorithmTable[algo] - if info.name == "" { - continue - } - - info.emptyTree = info.sum(emptyTreeInput) - - algorithmByName[info.name] = algo - if info.signatureHeaderName != "" { - algorithmBySignatureHeaderName[info.signatureHeaderName] = algo - } - - supportedAlgorithms = append(supportedAlgorithms, algo) - } -} -- cgit v1.3.1-10-gc9f91