EncodePassword encodes password using PBKDF2 SHA256 with given salt.
(password, salt string)
| 120 | |
| 121 | // EncodePassword encodes password using PBKDF2 SHA256 with given salt. |
| 122 | func 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. |
no outgoing calls