Created
August 15, 2013 17:05
-
-
Save KOBA789/6242561 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "crypto/md5" | |
| "strings" | |
| ) | |
| func md5sum(text string) string { | |
| h := md5.New() | |
| io.WriteString(h, text) | |
| return fmt.Sprintf("%x", h.Sum(nil)) | |
| } | |
| func createResponse(a string, method string, url string, nonce string, nc string, cnonce string, qop string) string { | |
| return md5sum(strings.Join([]string{a, nonce, nc, cnonce, qop, md5sum(strings.Join([]string{method, url}, ":"))}, ":")) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment