Skip to content

Commit

Permalink
make sure the standard algorithms are registered
Browse files Browse the repository at this point in the history
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 <github@gone.nl>
  • Loading branch information
thaJeztah committed Aug 18, 2021
1 parent b0b31a4 commit 084376b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions algorithm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"bytes"
"crypto"
"crypto/rand"
_ "crypto/sha256"
_ "crypto/sha512"
"flag"
"fmt"
"strings"
Expand Down
1 change: 0 additions & 1 deletion digestset/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package digestset

import (
"crypto/sha256"
_ "crypto/sha512"
"encoding/binary"
"math/rand"
"testing"
Expand Down
6 changes: 6 additions & 0 deletions sha.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package digest

import (
"crypto"

// make sure crypto.SHA256 is registered
_ "crypto/sha256"

// make sure crypto.sha512 and crypto.SHA384 are registered
_ "crypto/sha512"
)

const (
Expand Down

0 comments on commit 084376b

Please sign in to comment.