Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHashTooLong = errors.New("uciph/cutil/pwhash: Given hash is too long and can't be encoded with uciph's PWHash format")
var ErrSaltTooLong = errors.New("uciph/cutil/pwhash: Given salt is too long and can't be encoded with uciph's PWHash format")
Functions ¶
Types ¶
type Argon2Options ¶
Argon2Options represents Argon2 specific options.
type HashVersion ¶
type HashVersion = uint64
HashVersion is hasher identifier used for hash versioning.
type HashVersionMismatchError ¶
type HashVersionMismatchError struct { CurrentVersion HashVersion GivenVersion HashVersion }
HashVersionMismatchError is returned when PWHash version does not match one in hash.
func (*HashVersionMismatchError) Error ¶
func (e *HashVersionMismatchError) Error() string
type NoVerifierMatchedError ¶
type NoVerifierMatchedError struct {
Version HashVersion
}
NoVerifierMatchedError is returned, when no verifier could be matched in given VerifierChain.
func (*NoVerifierMatchedError) Error ¶
func (e *NoVerifierMatchedError) Error() string
type Options ¶
type Options struct { HashVersion HashVersion SaltSize int SaltRNG rand.RNG // Like salt, but stored outside DB and same for all users. // It's prepended to each password. // It should be long enough not to be brute-forceable. Pepper []byte }
type PWHash ¶
type PWHash struct { Version uint64 `json:"version,omitempty"` Hash []byte `json:"hash"` Salt []byte `json:"salt"` }
PWHash represents password hash with additonal options, useful for password hashing.
func (*PWHash) DecodeBytes ¶
DecodeBytes decodes given bytes to PWHash it's called on. These bytes should be created with PWHash.EncodeToBytes.
func (*PWHash) DecodeString ¶
DecodeString decodes PWHash encoded with PWHash.EncodeToString.
func (*PWHash) EncodeToBytes ¶
EncodeToBytes encodes this password hash to bytes. Password hash encoded this way may be decoded later.
func (*PWHash) EncodeToString ¶
EncodeToString encodes this PWHash to string.
type PWHashDecodeError ¶
type PWHashDecodeError struct {
Err error
}
func (*PWHashDecodeError) Error ¶
func (err *PWHashDecodeError) Error() string
func (*PWHashDecodeError) Unwrap ¶
func (err *PWHashDecodeError) Unwrap() error
type Verifier ¶
Verifier verifies hashes produced by PasswordHasher.
func VerifierChain ¶
VerifierChain creates verifier, which ingores HashVersionMismatchError and goes to next vefifier if such error occurrs.
Used for password versioning.