From 49054ca9e9c2a212a39b1a468a3bc47317e17974 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Thu, 22 Feb 2024 17:55:38 +0100 Subject: [PATCH] Remove unused function saslDigestResponse. --- xmpp.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/xmpp.go b/xmpp.go index 79443ce..673f0e0 100644 --- a/xmpp.go +++ b/xmpp.go @@ -16,7 +16,6 @@ import ( "bufio" "bytes" "crypto/hmac" - "crypto/md5" "crypto/rand" "crypto/sha1" "crypto/sha256" @@ -336,25 +335,6 @@ func (c *Client) Close() error { 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 { randSize := big.NewInt(0) randSize.Lsh(big.NewInt(1), 64)