复现双验签
This commit is contained in:
30
test/password_test.go
Normal file
30
test/password_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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("密码验证成功")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user