From dc1a3ff0cc56895a4a31cdf9f993bcf6078ce38b Mon Sep 17 00:00:00 2001 From: Gerard Snaauw Date: Wed, 18 Dec 2024 10:17:12 +0100 Subject: [PATCH] replace sha3.Sum384 with sha512.Sum384 (sha2) --- x509_cert/x509_cert.go | 3 +-- x509_cert/x509_cert_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/x509_cert/x509_cert.go b/x509_cert/x509_cert.go index 6b3578a..18b9c36 100644 --- a/x509_cert/x509_cert.go +++ b/x509_cert/x509_cert.go @@ -10,7 +10,6 @@ import ( "errors" "fmt" "github.com/lestrrat-go/jwx/v2/cert" - "golang.org/x/crypto/sha3" "regexp" "strings" ) @@ -40,7 +39,7 @@ func Hash(data []byte, alg string) ([]byte, error) { sum := sha256.Sum256(data) return sum[:], nil case "sha384": - sum := sha3.Sum384(data) + sum := sha512.Sum384(data) return sum[:], nil case "sha512": sum := sha512.Sum512(data) diff --git a/x509_cert/x509_cert_test.go b/x509_cert/x509_cert_test.go index 4f24a19..ca33e45 100644 --- a/x509_cert/x509_cert_test.go +++ b/x509_cert/x509_cert_test.go @@ -9,7 +9,6 @@ import ( "encoding/pem" "fmt" "github.com/stretchr/testify/assert" - "golang.org/x/crypto/sha3" "strings" "testing" ) @@ -17,7 +16,7 @@ import ( func TestHash(t *testing.T) { sha1sum := sha1.Sum([]byte("test")) sha256sum := sha256.Sum256([]byte("test")) - sha384sum := sha3.Sum384([]byte("test")) + sha384sum := sha512.Sum384([]byte("test")) sha512sum := sha512.Sum512([]byte("test")) testCases := []struct { name string