Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ENV environment variable name ENV = "ORIGADMIN_HASH_TYPE" // DefaultType default hash type DefaultType = "argon2" // DefaultVersion default hash version DefaultVersion = "v1" // DefaultSaltLength default salt length DefaultSaltLength = 16 // DefaultTimeCost default time cost for Argon2 DefaultTimeCost = 3 // DefaultMemoryCost default memory cost for Argon2 DefaultMemoryCost = 64 * 1024 // 64MB // DefaultThreads default number of threads for Argon2 DefaultThreads = 4 // DefaultCost default cost for bcrypt DefaultCost = 10 )
Variables ¶
View Source
var ( // ErrPasswordNotMatch error when password not match ErrPasswordNotMatch = errors.String("password not match") // ErrAlgorithmMismatch error when algorithm mismatch ErrAlgorithmMismatch = errors.String("algorithm mismatch") // ErrInvalidHashFormat error when invalid hash format ErrInvalidHashFormat = errors.String("invalid hash format") // ErrSaltLengthTooShort error when salt length too short ErrSaltLengthTooShort = errors.String("salt length must be at least 8 bytes") // ErrCostOutOfRange error when cost out of range ErrCostOutOfRange = errors.String("cost must be between 4 and 31") )
Functions ¶
func NewCodec ¶
func NewCodec(algorithm types.Type, opts ...CodecOption) interfaces.Codec
NewCodec creates a new codec
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec implements a generic hash codec
type CodecOption ¶
type CodecOption func(*Codec)
CodecOption defines configuration options for the codec
Click to show internal directories.
Click to hide internal directories.