forked from jshiffer/go-xmpp
Remove unused function saslDigestResponse.
This commit is contained in:
parent
b369b7df10
commit
49054ca9e9
20
xmpp.go
20
xmpp.go
@ -16,7 +16,6 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/md5"
|
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
@ -336,25 +335,6 @@ func (c *Client) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func saslDigestResponse(username, realm, passwd, nonce, cnonceStr, authenticate, digestURI, nonceCountStr string) string {
|
|
||||||
h := func(text string) []byte {
|
|
||||||
h := md5.New()
|
|
||||||
h.Write([]byte(text))
|
|
||||||
return h.Sum(nil)
|
|
||||||
}
|
|
||||||
hex := func(bytes []byte) string {
|
|
||||||
return fmt.Sprintf("%x", bytes)
|
|
||||||
}
|
|
||||||
kd := func(secret, data string) []byte {
|
|
||||||
return h(secret + ":" + data)
|
|
||||||
}
|
|
||||||
|
|
||||||
a1 := string(h(username+":"+realm+":"+passwd)) + ":" + nonce + ":" + cnonceStr
|
|
||||||
a2 := authenticate + ":" + digestURI
|
|
||||||
response := hex(kd(hex(h(a1)), nonce+":"+nonceCountStr+":"+cnonceStr+":auth:"+hex(h(a2))))
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
|
||||||
func cnonce() string {
|
func cnonce() string {
|
||||||
randSize := big.NewInt(0)
|
randSize := big.NewInt(0)
|
||||||
randSize.Lsh(big.NewInt(1), 64)
|
randSize.Lsh(big.NewInt(1), 64)
|
||||||
|
Loading…
Reference in New Issue
Block a user