Skip to content

Commit 084376b

Browse files
committed
make sure the standard algorithms are registered
This makes sure that the expected algorithms are registered when using this package. Currently, the consumer of the package must import these, otherwise it's not registered, resultig in "unsupported digest algorithm" errors. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent b0b31a4 commit 084376b

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

algorithm_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"bytes"
2020
"crypto"
2121
"crypto/rand"
22-
_ "crypto/sha256"
23-
_ "crypto/sha512"
2422
"flag"
2523
"fmt"
2624
"strings"

digestset/set_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package digestset
1717

1818
import (
1919
"crypto/sha256"
20-
_ "crypto/sha512"
2120
"encoding/binary"
2221
"math/rand"
2322
"testing"

sha.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ package digest
22

33
import (
44
"crypto"
5+
6+
// make sure crypto.SHA256 is registered
7+
_ "crypto/sha256"
8+
9+
// make sure crypto.sha512 and crypto.SHA384 are registered
10+
_ "crypto/sha512"
511
)
612

713
const (

0 commit comments

Comments
 (0)