Documentation ¶
Overview ¶
Simple library for working with passwords in Go. All generated passwords are going to be a minimum of 8 characters in length.
Index ¶
- type Password
- func (p *Password) ComplexityRating() string
- func (p *Password) GetLength() int
- func (p *Password) GetScore() int
- func (p *Password) HasLower() bool
- func (p *Password) HasNumber() bool
- func (p *Password) HasSpecial() bool
- func (p *Password) HasUpper() bool
- func (p *Password) InDictionary() bool
- func (p *Password) MD5(saltConf ...*SaltConf) ([16]byte, []byte)
- func (p *Password) ProcessPassword()
- func (p *Password) SHA256(saltConf ...*SaltConf) ([32]byte, []byte)
- func (p *Password) SHA512(saltConf ...*SaltConf) ([64]byte, []byte)
- type SaltConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Password ¶
type Password struct { Pass string Length int Score int ContainsUpper bool ContainsLower bool ContainsNumber bool ContainsSpecial bool DictionaryBased bool }
func GeneratePassword ¶
GeneratePassword will generate and return a password as a string and as a byte slice of the given length.
func GenerateVeryStrongPassword ¶
GenerateVeryStrongPassword will generate a "Very Strong" password.
func New ¶
New is used when a user enters a password as well as the being called from the GeneratePassword function.
func (*Password) ComplexityRating ¶
ComplexityRating provides the rating for the password.
func (*Password) GetLength ¶
GetLength will provide the length of the password. This method is being put on the password struct in case someone decides not to do a complexity check.
func (*Password) HasSpecial ¶
HasSpecial indicates whether the password contains a special character.
func (*Password) InDictionary ¶
InDictionary will return true or false if it's been detected that the given password is a dictionary based.
func (*Password) MD5 ¶
MD5 sum for the given password. If a SaltConf pointer is given as a parameter a salt with the given length will be returned with it included in the hash.
func (*Password) ProcessPassword ¶
func (p *Password) ProcessPassword()
ProcessPassword will parse the password and populate the Password struct attributes.