MCPcopy Create free account
hub / github.com/bodhiye/paste / String2bcrypt

Function String2bcrypt

server/util/util.go:53–60  ·  view source on GitHub ↗

String2bcryt 返回输入字符串的 bcrypt 哈希值

(str string)

Source from the content-addressed store, hash-verified

51
52// String2bcryt 返回输入字符串的 bcrypt 哈希值
53func String2bcrypt(str string) string {
54 hashedPassword, err := bcrypt.GenerateFromPassword([]byte(str), bcrypt.DefaultCost)
55 if err != nil {
56 log.Fatalf("Encryption failure: %+v", err)
57 return ""
58 }
59 return string(hashedPassword)
60}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected