From 0b19f6cf5ab65bb6efb856b761a96ca52631e865 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 26 Jul 2024 19:10:25 +0200 Subject: [PATCH] Switch back to sha256 from the std library The std library now also supports the sha assembly instructions on ARM64. Thus, sha256-simd no longer provides a performance benefit. --- cmd/restic/cmd_stats.go | 2 +- go.mod | 1 - go.sum | 2 -- internal/backend/test/tests.go | 2 +- internal/fuse/snapshots_dirstruct.go | 3 +-- internal/repository/check.go | 2 +- internal/repository/packer_manager.go | 3 +-- internal/restic/id.go | 3 +-- 8 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cmd/restic/cmd_stats.go b/cmd/restic/cmd_stats.go index 60ab1e5bc..5d105e31c 100644 --- a/cmd/restic/cmd_stats.go +++ b/cmd/restic/cmd_stats.go @@ -2,6 +2,7 @@ package main import ( "context" + "crypto/sha256" "encoding/json" "fmt" "path/filepath" @@ -16,7 +17,6 @@ import ( "github.com/restic/restic/internal/ui/table" "github.com/restic/restic/internal/walker" - "github.com/minio/sha256-simd" "github.com/spf13/cobra" ) diff --git a/go.mod b/go.mod index 043e72ed9..e1c92c2fa 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/klauspost/compress v1.17.9 github.com/minio/minio-go/v7 v7.0.74 - github.com/minio/sha256-simd v1.0.1 github.com/ncw/swift/v2 v2.0.2 github.com/peterbourgon/unixtransport v0.0.4 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 052c9fef0..d75b70d14 100644 --- a/go.sum +++ b/go.sum @@ -148,8 +148,6 @@ github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.74 h1:fTo/XlPBTSpo3BAMshlwKL5RspXRv9us5UeHEGYCFe0= github.com/minio/minio-go/v7 v7.0.74/go.mod h1:qydcVzV8Hqtj1VtEocfxbmVFa2siu6HGa+LDEPogjD8= -github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= -github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/ncw/swift/v2 v2.0.2 h1:jx282pcAKFhmoZBSdMcCRFn9VWkoBIRsCpe+yZq7vEk= github.com/ncw/swift/v2 v2.0.2/go.mod h1:z0A9RVdYPjNjXVo2pDOPxZ4eu3oarO1P91fTItcb+Kg= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= diff --git a/internal/backend/test/tests.go b/internal/backend/test/tests.go index e2879a3bd..800d1f8c0 100644 --- a/internal/backend/test/tests.go +++ b/internal/backend/test/tests.go @@ -3,6 +3,7 @@ package test import ( "bytes" "context" + "crypto/sha256" "fmt" "io" "math/rand" @@ -12,7 +13,6 @@ import ( "testing" "time" - "github.com/minio/sha256-simd" "github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/restic" diff --git a/internal/fuse/snapshots_dirstruct.go b/internal/fuse/snapshots_dirstruct.go index 049319c6f..03ff53193 100644 --- a/internal/fuse/snapshots_dirstruct.go +++ b/internal/fuse/snapshots_dirstruct.go @@ -6,6 +6,7 @@ package fuse import ( "bytes" "context" + "crypto/sha256" "fmt" "path" "sort" @@ -15,8 +16,6 @@ import ( "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" - - "github.com/minio/sha256-simd" ) type MetaDirData struct { diff --git a/internal/repository/check.go b/internal/repository/check.go index 1eeea58dc..4e57a7c1c 100644 --- a/internal/repository/check.go +++ b/internal/repository/check.go @@ -4,12 +4,12 @@ import ( "bufio" "bytes" "context" + "crypto/sha256" "fmt" "io" "sort" "github.com/klauspost/compress/zstd" - "github.com/minio/sha256-simd" "github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/errors" diff --git a/internal/repository/packer_manager.go b/internal/repository/packer_manager.go index 213a3df41..8dd8f71c1 100644 --- a/internal/repository/packer_manager.go +++ b/internal/repository/packer_manager.go @@ -3,6 +3,7 @@ package repository import ( "bufio" "context" + "crypto/sha256" "io" "os" "runtime" @@ -17,8 +18,6 @@ import ( "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/fs" "github.com/restic/restic/internal/repository/pack" - - "github.com/minio/sha256-simd" ) // packer holds a pack.packer together with a hash writer. diff --git a/internal/restic/id.go b/internal/restic/id.go index e71c6d71b..0742cd6f1 100644 --- a/internal/restic/id.go +++ b/internal/restic/id.go @@ -2,11 +2,10 @@ package restic import ( "crypto/rand" + "crypto/sha256" "encoding/hex" "fmt" "io" - - "github.com/minio/sha256-simd" ) // Hash returns the ID for data.