Skip to content

Commit 8f62119

Browse files
authored
add support for lowercase digest algorithms (#14)
1 parent c2fe096 commit 8f62119

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

digest.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ type Options struct {
3636

3737
// CanDigest checks if the algorithm and qop are supported
3838
func CanDigest(c *Challenge) bool {
39-
switch c.Algorithm {
39+
algorithm := strings.ToUpper(c.Algorithm)
40+
switch algorithm {
4041
case "", "MD5", "SHA-256", "SHA-512", "SHA-512-256":
4142
default:
4243
return false
@@ -60,7 +61,8 @@ func Digest(chal *Challenge, o Options) (*Credentials, error) {
6061
}
6162
// we re-use the same hash.Hash
6263
var h hash.Hash
63-
switch cred.Algorithm {
64+
algorithm := strings.ToUpper(cred.Algorithm)
65+
switch algorithm {
6466
case "", "MD5":
6567
h = md5.New()
6668
case "SHA-256":

0 commit comments

Comments
 (0)