tlm-login-server/internal/shared/check-password.go

18 lines
405 B
Go
Raw Normal View History

2023-12-06 23:25:34 +01:00
package shared
import (
"fmt"
"golang.org/x/crypto/bcrypt"
)
// CheckPassword compares []byte password and []byte hash.
//
// Returns true if hashes match, false if not.
func CheckPassword(password []byte, hash []byte) bool {
fmt.Println(fmt.Sprintf("Hash: %v", hash))
fmt.Println(fmt.Sprintf("Hashlength: %v", len(hash)))
err := bcrypt.CompareHashAndPassword(hash, password)
return err == nil
}