Use minio/sha256-simd for accelerated SHA256 (#23052)

minio/sha256-simd provides additional acceleration for SHA256 using
AVX512, SHA Extensions for x86 and ARM64 for ARM.

It provides a drop-in replacement for crypto/sha256 and if the
extensions are not available it falls back to standard crypto/sha256.

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
zeripath 2023-02-22 19:21:46 +00:00 committed by GitHub
parent eb5a55785d
commit 1319ba6742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 33 additions and 24 deletions

View file

@ -11,7 +11,6 @@ import (
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
@ -34,6 +33,7 @@ import (
chef_router "code.gitea.io/gitea/routers/api/packages/chef"
"code.gitea.io/gitea/tests"
"github.com/minio/sha256-simd"
"github.com/stretchr/testify/assert"
)

View file

@ -5,7 +5,6 @@ package integration
import (
"bytes"
"crypto/sha256"
"encoding/base64"
"fmt"
"net/http"
@ -24,6 +23,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"
"github.com/minio/sha256-simd"
oci "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/assert"
)

View file

@ -5,7 +5,6 @@ package integration
import (
"bytes"
"crypto/sha256"
"fmt"
"net/http"
"strings"
@ -24,6 +23,7 @@ import (
packages_cleanup_service "code.gitea.io/gitea/services/packages/cleanup"
"code.gitea.io/gitea/tests"
"github.com/minio/sha256-simd"
"github.com/stretchr/testify/assert"
)