From cd57f86e5a22fd806eef7cfd57b7a8b2f0d6b67a Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 2 Nov 2020 14:13:06 +0100 Subject: [PATCH] Adding missing bcrypt library to imports --- go.mod | 1 + utils/coreutils.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 671a9b7ff..f0f3c071a 100644 --- a/go.mod +++ b/go.mod @@ -60,6 +60,7 @@ require ( github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/xdg/stringprep v1.0.1-0.20180714160509-73f8eece6fdc // indirect go.mongodb.org/mongo-driver v1.4.0 + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 golang.org/x/net v0.0.0-20200707034311-ab3426394381 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d google.golang.org/api v0.29.0 diff --git a/utils/coreutils.go b/utils/coreutils.go index ea3dc8ac3..8ddd3040e 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -44,6 +44,7 @@ import ( "time" "github.com/cgrates/rpcclient" + "golang.org/x/crypto/bcrypt" ) var ( @@ -995,7 +996,7 @@ func AESDecrypt(encrypted string, encKey string) (txt string, err error) { } // Hash generates the hash text -func Hash(dataKeys ...string) (lns string, err error) { +func ComputeHash(dataKeys ...string) (lns string, err error) { var hashByts []byte if hashByts, err = bcrypt.GenerateFromPassword( []byte(ConcatenatedKey(dataKeys...)), @@ -1007,6 +1008,7 @@ func Hash(dataKeys ...string) (lns string, err error) { // VerifyHash matches the data hash with the dataKeys ha func VerifyHash(hash string, dataKeys ...string) bool { - err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(ConcatenatedKey(dataKeys...))) + err := bcrypt.CompareHashAndPassword([]byte(hash), + []byte(ConcatenatedKey(dataKeys...))) return err == nil }