1 Star 0 Fork 0

瑞哥 / util

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
createPassword.go 704 Bytes
一键复制 编辑 原始数据 按行查看 历史
瑞哥 提交于 2023-06-23 03:43 . 0.0
package rpwd
import (
"crypto/sha256"
"fmt"
"time"
)
// InitCreatePasswordFile 初始化创建一个password文件。
func InitCreatePasswordFile(filepath string) {
hashStr1 := fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint(time.Now()))))
hashStr2 := fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint(time.Now().AddDate(1, 2, 3)))))
_ = AutoSavePasswordFile(filepath, map[string]AccountAndPassword{
AccMongoDB: {Port: 27017, Account: "root", Password: "123456"},
AccRedis: {Port: 6379, Password: "123456"},
AccMySQL: {Port: 3306, Account: "root", Password: "123456"},
}, map[string]string{
KeyJwtSecretKey: hashStr1[:32],
KeyPwdSecretKey: hashStr2[:32],
}, map[string]any{})
}
Go
1
https://gitee.com/ruige_fun/util.git
git@gitee.com:ruige_fun/util.git
ruige_fun
util
util
v0.1.4

搜索帮助