Documentation ¶
Index ¶
- Variables
- func ComparePassword(hash, password []byte) error
- func ComparePasswordString(hash []byte, password string) error
- func DecodePasswordHash(encoded string) (decoded []byte, err error)
- func GenerateEncodedPassword(passwd string) (encoded string, err error)
- func NewSalt() ([]byte, error)
- type SaltedManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyPassword means that an empty password was given. ErrEmptyPassword = errors.New("empty password") )
Functions ¶
func ComparePassword ¶
ComparePassword compares a given password with the given hash.
func ComparePasswordString ¶
ComparePasswordString compares a given password string with the given hash.
func DecodePasswordHash ¶
DecodePasswordHash takes a base64-encoded password hash and returns the appropriate bytes.
func GenerateEncodedPassword ¶
GenerateEncodedPassword returns an encrypted password, encoded into a string with base64.
Types ¶
type SaltedManager ¶
type SaltedManager struct {
// contains filtered or unexported fields
}
SaltedManager supports the hashing and comparing of passwords with the given salt.
func NewSaltedManager ¶
func NewSaltedManager(salt []byte) SaltedManager
NewSaltedManager returns a new SaltedManager with the given salt.
func (*SaltedManager) CompareHashAndPassword ¶
func (sm *SaltedManager) CompareHashAndPassword(hashedPassword []byte, specialSalt []byte, password string) error
CompareHashAndPassword compares a hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.
func (*SaltedManager) GenerateFromPassword ¶
func (sm *SaltedManager) GenerateFromPassword(specialSalt []byte, password string) ([]byte, error)
GenerateFromPassword encrypts the given password.
Click to show internal directories.
Click to hide internal directories.