commit
This commit is contained in:
24
go_backend/cmd/test_password_hash.go
Normal file
24
go_backend/cmd/test_password_hash.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// 测试密码
|
||||
passwords := []string{
|
||||
"123456",
|
||||
"password",
|
||||
"admin123",
|
||||
}
|
||||
|
||||
fmt.Println("=== Go SHA256 密码加密测试 ===")
|
||||
for _, pwd := range passwords {
|
||||
hash := sha256.Sum256([]byte(pwd))
|
||||
hashStr := hex.EncodeToString(hash[:])
|
||||
fmt.Printf("密码: %s\n", pwd)
|
||||
fmt.Printf("SHA256: %s\n\n", hashStr)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user