Skip to content

Commit 8447849

Browse files
author
Adam Hasselbalch Hansen
committed
unexport random key gen
1 parent d76a4fe commit 8447849

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

digest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func getMD5(text string) string {
8585
return hex.EncodeToString(hasher.Sum(nil))
8686
}
8787

88-
func RandomKey() string {
88+
func randomKey() string {
8989
k := make([]byte, 12)
9090
for bytes := 0; bytes < len(k); {
9191
n, err := rand.Read(k[bytes:])
@@ -101,7 +101,7 @@ func getDigestAuthrization(digestParts map[string]string) string {
101101
ha1 := getMD5(d["username"] + ":" + d["realm"] + ":" + d["password"])
102102
ha2 := getMD5(d["method"] + ":" + d["uri"])
103103
nonceCount := "00000001"
104-
cnonce := RandomKey()
104+
cnonce := randomKey()
105105
response := getMD5(fmt.Sprintf("%s:%s:%s:%s:%s:%s", ha1, d["nonce"], nonceCount, cnonce, d["qop"], ha2))
106106
authorization := fmt.Sprintf(`Digest username="%s", realm="%s", nonce="%s", uri="%s", cnonce="%s", nc=%s, qop="%s", response="%s", opaque="%s", algorithm="%s"`,
107107
d["username"], d["realm"], d["nonce"], d["uri"], cnonce, nonceCount, d["qop"], response, d["opaque"], d["algorithm"])

0 commit comments

Comments
 (0)