Vestmore_GO/test/password_test.go
2024-04-11 14:57:47 +08:00

31 lines
710 B
Go

package vertmore_test
import (
"crypto/sha1"
"fmt"
"log"
"testing"
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/auth"
)
func TestPassword(t *testing.T) {
// customer := map[string]string{
// "password": "486790f71aea661645b38e94c2734e454dd73a4d",
// "salt": "b83192106fa45fef0d914c579848ebea",
// "random_password": "709889",
// }
// password := "6601502.."
password := "709889"
pwdhash := fmt.Sprintf("%x", sha1.Sum([]byte(password)))
log.Println()
if !auth.CheckPassword("486790f71aea661645b38e94c2734e454dd73a4d", "b83192106fa45fef0d914c579848ebea", "709889", pwdhash) {
fmt.Println("密码验证失败")
} else {
fmt.Println("密码验证成功")
}
}