MCPcopy Index your code
hub / github.com/gogs/gogs / EncodePassword

Function EncodePassword

internal/userutil/userutil.go:122–125  ·  view source on GitHub ↗

EncodePassword encodes password using PBKDF2 SHA256 with given salt.

(password, salt string)

Source from the content-addressed store, hash-verified

120
121// EncodePassword encodes password using PBKDF2 SHA256 with given salt.
122func EncodePassword(password, salt string) string {
123 newPasswd := pbkdf2.Key([]byte(password), []byte(salt), 10000, 50, sha256.New)
124 return fmt.Sprintf("%x", newPasswd)
125}
126
127// ValidatePassword returns true if the given password matches the encoded
128// version with given salt.

Callers 5

CreateMethod · 0.92
UpdateMethod · 0.92
ValidatePasswordFunction · 0.85
TestEncodePasswordFunction · 0.85
TestValidatePasswordFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestEncodePasswordFunction · 0.68
TestValidatePasswordFunction · 0.68