Skip to content

Commit

Permalink
replace sha3.Sum384 with sha512.Sum384 (sha2)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardsn committed Dec 18, 2024
1 parent dcc0eed commit dc1a3ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions x509_cert/x509_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"github.com/lestrrat-go/jwx/v2/cert"
"golang.org/x/crypto/sha3"
"regexp"
"strings"
)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions x509_cert/x509_cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import (
"encoding/pem"
"fmt"
"github.com/stretchr/testify/assert"
"golang.org/x/crypto/sha3"
"strings"
"testing"
)

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
Expand Down

0 comments on commit dc1a3ff

Please sign in to comment.