Merge pull request #10579 from Lyndon-Li/change-kopia-hashing-alg
Run the E2E test on kind / setup-test-matrix (push) Failing after 4s
e2e-test-kind.yaml / extract (push) Failing after 9s
Run the E2E test on kind / get-go-version (push) Failing after 10s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 6s
Scorecard supply-chain security / Scorecard analysis (push) Skipped
Main CI / get-go-version (push) Failing after 6s
Main CI / Build (push) Skipped

Change hashing algorithm to HMAC-SHA256-128 for kopia repo
This commit is contained in:
lyndon-li
2026-09-25 10:06:30 +08:00
committed by GitHub
3 changed files with 8 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
Fix issue #10576, change hashing algorithm to HMAC-SHA256-128 for kopia repo
@@ -26,15 +26,15 @@ import (
"github.com/kopia/kopia/repo/content"
"github.com/kopia/kopia/repo/encryption"
"github.com/kopia/kopia/repo/format"
"github.com/kopia/kopia/repo/hashing"
"github.com/kopia/kopia/repo/splitter"
"github.com/vmware-tanzu/velero/pkg/repository/udmrepo"
)
const (
DefaultCacheLimitMB = 5000
maxCacheDurationSecond = 30
DefaultCacheLimitMB = 5000
maxCacheDurationSecond = 30
defaultHashingAlgorithm = "HMAC-SHA256-128"
)
func setupLimits(ctx context.Context, flags map[string]string) throttling.Limits {
@@ -51,7 +51,7 @@ func setupLimits(ctx context.Context, flags map[string]string) throttling.Limits
func SetupNewRepositoryOptions(ctx context.Context, flags map[string]string) repo.NewRepositoryOptions {
return repo.NewRepositoryOptions{
BlockFormat: format.ContentFormat{
Hash: optionalHaveStringWithDefault(udmrepo.StoreOptionGenHashAlgo, flags, hashing.DefaultAlgorithm),
Hash: optionalHaveStringWithDefault(udmrepo.StoreOptionGenHashAlgo, flags, defaultHashingAlgorithm),
Encryption: optionalHaveStringWithDefault(udmrepo.StoreOptionGenEncryptAlgo, flags, encryption.DefaultAlgorithm),
},
@@ -24,7 +24,6 @@ import (
"github.com/kopia/kopia/repo/content"
"github.com/kopia/kopia/repo/encryption"
"github.com/kopia/kopia/repo/format"
"github.com/kopia/kopia/repo/hashing"
"github.com/kopia/kopia/repo/splitter"
"github.com/stretchr/testify/assert"
@@ -59,7 +58,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) {
},
expected: repo.NewRepositoryOptions{
BlockFormat: format.ContentFormat{
Hash: hashing.DefaultAlgorithm,
Hash: defaultHashingAlgorithm,
Encryption: "fake-encrypt",
},
ObjectFormat: format.ObjectFormat{
@@ -74,7 +73,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) {
},
expected: repo.NewRepositoryOptions{
BlockFormat: format.ContentFormat{
Hash: hashing.DefaultAlgorithm,
Hash: defaultHashingAlgorithm,
Encryption: encryption.DefaultAlgorithm,
},
ObjectFormat: format.ObjectFormat{
@@ -89,7 +88,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) {
},
expected: repo.NewRepositoryOptions{
BlockFormat: format.ContentFormat{
Hash: hashing.DefaultAlgorithm,
Hash: defaultHashingAlgorithm,
Encryption: encryption.DefaultAlgorithm,
},
ObjectFormat: format.ObjectFormat{