Skip to content

Instantly share code, notes, and snippets.

@KOBA789
Created August 15, 2013 17:05
Show Gist options
  • Save KOBA789/6242561 to your computer and use it in GitHub Desktop.
Save KOBA789/6242561 to your computer and use it in GitHub Desktop.
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