mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-13 11:06:25 +05:00
Adding missing bcrypt library to imports
This commit is contained in:
1
go.mod
1
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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user