-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,10 +112,17 @@ func TestDigestSHA256(t *testing.T) { | |
} | ||
|
||
func TestDigestA1(t *testing.T) { | ||
h := sha256.New() | ||
fmt.Fprintf(h, "%s:%s:%s", | ||
"Mufasa", // username | ||
"[email protected]", // realm | ||
"Circle of Life", // password | ||
) | ||
a1 := hex.EncodeToString(h.Sum(nil)) | ||
opt := Options{ | ||
Method: "GET", | ||
URI: "/dir/index.html", | ||
A1: sha265Hash("%s:%s:%s", "Mufasa", "[email protected]", "Circle of Life"), | ||
A1: a1, | ||
Cnonce: "f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", | ||
} | ||
chal := &Challenge{ | ||
|
@@ -204,9 +211,3 @@ func TestDigestAuthInt(t *testing.T) { | |
Nc: 1, | ||
}) | ||
} | ||
|
||
func sha265Hash(format string, args ...interface{}) string { | ||
h := sha256.New() | ||
fmt.Fprintf(h, format, args...) | ||
return hex.EncodeToString(h.Sum(nil)) | ||
} |