MCPcopy Index your code
hub / github.com/TruthHun/BookStack / salt

Function salt

utils/password.go:110–122  ·  view source on GitHub ↗
(secret string)

Source from the content-addressed store, hash-verified

108 }
109}
110func salt(secret string) (string, error) {
111
112 buf := make([]byte, saltSize, saltSize+md5.Size)
113 _, err := io.ReadFull(rand.Reader, buf)
114 if err != nil {
115 return "", err
116 }
117
118 hash := md5.New()
119 hash.Write(buf)
120 hash.Write([]byte(secret))
121 return hex.EncodeToString(hash.Sum(buf)), nil
122}
123
124func saltSecret() (string, error) {
125 rb := make([]byte, randInt(10, 100))

Callers 1

PasswordHashFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected