feat(1.0): 初始化项目
This commit is contained in:
parent
7c060c216a
commit
c291afd38e
@ -14,6 +14,4 @@ pass = 'api2api..'
|
||||
user = 'root'
|
||||
|
||||
[jwt]
|
||||
admin_secret = "m9ycX9RTPyuYTWw9FrMm"
|
||||
patient_secret = "p0yxX0RTPyuYTWw0FrPp"
|
||||
doctor_secret = "d8ycC8RTPyuYTWw8FrDd"
|
||||
admin_secret = "m9ycX9RTPyuYTWw9FrCc"
|
||||
3666
docs/docs.go
3666
docs/docs.go
File diff suppressed because it is too large
Load Diff
3666
docs/swagger.json
3666
docs/swagger.json
File diff suppressed because it is too large
Load Diff
2522
docs/swagger.yaml
2522
docs/swagger.yaml
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ import (
|
||||
|
||||
// GenerateAdminHashedPassword [管理端]生成密码
|
||||
func GenerateAdminHashedPassword(password string) (string, error) {
|
||||
salt := "7M&7p7euU=MM"
|
||||
salt := "7M&7p7euU=CC"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(passwordWithSalt), bcrypt.DefaultCost)
|
||||
@ -30,51 +30,7 @@ func GenerateAdminHashedPassword(password string) (string, error) {
|
||||
|
||||
// VerifyAdminHashedPassword [管理端]验证密码
|
||||
func VerifyAdminHashedPassword(hashedPassword, password string) bool {
|
||||
salt := "7M&7p7euU=MM"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hashedPassword+salt), []byte(passwordWithSalt))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// GenerateDoctorHashedPassword [医生端]生成密码
|
||||
func GenerateDoctorHashedPassword(password string) (string, error) {
|
||||
salt := "9M&9p9euU=DD"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(passwordWithSalt), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(hashedPassword), nil
|
||||
}
|
||||
|
||||
// VerifyDoctorHashedPassword [医生端]验证密码
|
||||
func VerifyDoctorHashedPassword(hashedPassword, password string) bool {
|
||||
salt := "9M&9p9euU=DD"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hashedPassword+salt), []byte(passwordWithSalt))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// GeneratePatientHashedPassword [患者端]生成密码
|
||||
func GeneratePatientHashedPassword(password string) (string, error) {
|
||||
salt := "8T&8p8euU=PP"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(passwordWithSalt), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(hashedPassword), nil
|
||||
}
|
||||
|
||||
// VerifyPatientHashedPassword [患者端]验证密码
|
||||
func VerifyPatientHashedPassword(hashedPassword, password string) bool {
|
||||
salt := "8T&8p8euU=PP"
|
||||
salt := "7M&7p7euU=CC"
|
||||
passwordWithSalt := password + salt
|
||||
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hashedPassword+salt), []byte(passwordWithSalt))
|
||||
|
||||
@ -7,18 +7,8 @@ import (
|
||||
)
|
||||
|
||||
func TestGenerateAdminHashedPassword(t *testing.T) {
|
||||
t.Log(MD5("admin2025"))
|
||||
t.Log(GenerateAdminHashedPassword(MD5("admin2025")))
|
||||
}
|
||||
|
||||
func TestGenerateDoctorHashedPassword(t *testing.T) {
|
||||
t.Log(MD5("doctor2025"))
|
||||
t.Log(GenerateDoctorHashedPassword(MD5("doctor2025")))
|
||||
}
|
||||
|
||||
func TestGeneratePatientHashedPassword(t *testing.T) {
|
||||
t.Log(MD5("patient2025"))
|
||||
t.Log(GeneratePatientHashedPassword(MD5("patient2025")))
|
||||
t.Log(MD5("chat2025"))
|
||||
t.Log(GenerateAdminHashedPassword(MD5("chat2025")))
|
||||
}
|
||||
|
||||
func TestXorEncrypt(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user