From faaf6128fb4f8c104d6f81c9cb360b9cfdf35693 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 6 Apr 2018 12:50:06 +0300 Subject: [PATCH] Fix sha1 compute --- pkg/server/handlers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/server/handlers.go b/pkg/server/handlers.go index 1e23163..7e7cc46 100644 --- a/pkg/server/handlers.go +++ b/pkg/server/handlers.go @@ -3,8 +3,8 @@ package server import ( "bytes" "crypto/sha1" + "encoding/hex" "encoding/json" - "fmt" "io/ioutil" "net/http" "os" @@ -268,5 +268,6 @@ func (s *Server) panic(w http.ResponseWriter, r *http.Request) { func hash(input string) string { h := sha1.New() - return fmt.Sprintf("%x", h.Sum([]byte(input))) + h.Write([]byte(input)) + return hex.EncodeToString(h.Sum(nil)) }