diff options
Diffstat (limited to 'pkg/server/module/auth.go')
| -rw-r--r-- | pkg/server/module/auth.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/pkg/server/module/auth.go b/pkg/server/module/auth.go index f167874..d4bc8b3 100644 --- a/pkg/server/module/auth.go +++ b/pkg/server/module/auth.go @@ -3,7 +3,6 @@ package module import ( "crypto/md5" "crypto/rand" - "encoding/hex" "errors" "fmt" "io" @@ -43,10 +42,7 @@ func (a *auth) generateChallenge() error { return err } - c := make([]byte, hex.EncodedLen(len(b))) - hex.Encode(c, b) - - a.challenge.self = string(c) + a.challenge.self = string(b) return nil } @@ -59,13 +55,11 @@ func (a *auth) sendChallenge(q queue.Q) bool { func (a *auth) getHash(c string) string { h := md5.New() + io.WriteString(h, a.secret) io.WriteString(h, c) - b := make([]byte, hex.EncodedLen(h.Size())) - hex.Encode(b, h.Sum(nil)) - - return string(b) + return string(h.Sum(nil)) } func (a *auth) sendHash(q queue.Q) bool { |
