Documentation ¶
Index ¶
- func CheckPassword(username, pwd, salt, key string) bool
- func GenSalt(args ...string) string
- func GetByteKey(username, pwd, salt string) []byte
- func GetKey(username, pwd, salt string) string
- func SecureRandomBytes(length int) ([]byte, error)
- func SecureRandomString(length int) (ret string, err error)
- func WebAPIPasswordEncode(username, plainPass string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword allows to compare password from request with salted value from database.
func GenSalt ¶
GenSalt generates a salt from given data. It also appends current time in nanoseconds to args before salt generation. Salt generator is a chained sha256 (salt = sha256(salt, args[i])). Number of iterations is a number of args + 1. Result salt returned in base64-encoded string.
func GetByteKey ¶
GetByteKey generates a salted password using pbkdf2 algorithm.
func SecureRandomBytes ¶
SecureRandomBytes returns the requested number of bytes using crypto/rand
func SecureRandomString ¶
SecureRandomString securly generates random string
func WebAPIPasswordEncode ¶
WebAPIPasswordEncode needed to encode password with function from old web-api to allow old users to login.
Types ¶
This section is empty.