Documentation ¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func EncryptPassword ¶
func EncryptPassword(pass string, alg PASSWORD_ALG) (string, error)
func EqualPassword ¶
func GeneratePassword ¶
Types ¶
type PASSWORD_ALG ¶
type PASSWORD_ALG = string
const ( PASSWORD_ALG_NOOP PASSWORD_ALG = "noop" PASSWORD_ALG_BCRYPT PASSWORD_ALG = "bcrypt" PASSWORD_ALG_MD5 PASSWORD_ALG = "md5" PASSWORD_ALG_SHA256 PASSWORD_ALG = "sha256" )
type PasswordEncoder ¶
type PasswordEncoder interface { Alg() string Encrypt(pwd string) (string, error) // encryptPass without prefix Equal(pass string, encryptPass string) bool // contains filtered or unexported methods }
func GetPasswordAlg ¶
func GetPasswordAlg(encryptPass string) (PasswordEncoder, string)
{noop}password {bcrypt}$2a$10$IK/02aEUVRBaeoQsvN.VluPLqNKZ2ZwwTRmAAWXmlnCU5DAjmjtRC {MD5}5f4dcc3b5aa765d61d8327deb882cf99 {MD5}{L5M7tjEyGdBtyFCyk0pBXOLLFi3AOMEBZqdRDTAwV6c=}c05b48c699659f56462bbed387485cc6
func New ¶
func New(_alg *string) (encoder PasswordEncoder)
alg string will not convert in this func, please use the right way default is bcrypt
Click to show internal directories.
Click to hide internal directories.