Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultAlgorithm defines the default algorithm to use when not specified DefaultAlgorithm = hasher.Argon2id // ExpectedAlgorithmVersion defines the lower supported version of the hashing strategy ExpectedAlgorithmVersion = uint8(0x01) )
Variables ¶
View Source
var ( // ErrInvalidHash is raised when caller try to invoke not supported algorithm ErrInvalidHash = errors.New("butcher: invalid hash") // ErrStrategyNotSupported is raised when caller try to invoke not supported algorithm ErrStrategyNotSupported = errors.New("butcher: given strategy is not supported") )
View Source
var DefaultSaltFunc = RandomNonce(32)
DefaultSaltFunc defines the default salt generation factory to use when not specified
Functions ¶
func FixedNonce ¶
FixedNonce returns a nonce factory that returns the given salt
func NeedsUpgrade ¶
NeedsUpgrade returns the password hash upgrade need when DefaultAlgorithm is changed
func RandomNonce ¶
RandomNonce returns a nonce factory that returns a random length bound salt
Types ¶
type Butcher ¶
type Butcher struct {
// contains filtered or unexported fields
}
Butcher defines the hasher configuration
func (*Butcher) NeedsUpgrade ¶ added in v0.0.3
NeedsUpgrade returns the password hash upgrade need when DefaultAlgorithm is changed
type Option ¶
type Option func(*Butcher)
Option is the butcher option setting function signature
func WithAlgorithm ¶
WithAlgorithm defines the algorithm to use for hashing password
func WithPepper ¶ added in v0.0.3
WithPepper defines the password peppering value
func WithSaltFunc ¶ added in v0.0.3
WithSaltFunc defines the salt factory value for salt generation
Click to show internal directories.
Click to hide internal directories.