Documentation ¶
Overview ¶
Package hashutil provides general utility functionalities to generate simple and fast hashes with salt and pepper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidFormat is returned when the passed hash has // an invalid format. ErrInvalidFormat = errors.New("invalid hash format") // ErrInvalidSaltSize is returned when a salt size of <= 0 is // provided on hash generation. ErrInvalidSaltSize = errors.New("invalid salt size: must be larger than 0") // ErrUnsupportedHashFunction is returned when a hash function // name was provided which is not supported. ErrUnsupportedHashFunction = errors.New("unsupported hash function") )
Functions ¶
Types ¶
type Hasher ¶
type Hasher struct { // HashFunc specifies the used hashing function. HashFunc crypto.Hash // SaltSize specifies the length of the randomly // generated salt byte array. SaltSize int // PepperGetter is a function used to obtain a // pepper byte array used in the hash generation. // // When no function is specified, no pepper will // be passed in the hash generation. PepperGetter func() ([]byte, error) }
Hasher specifies the parameters for the hash generation like the used hash function, salt byte size and pepper getter function.
Click to show internal directories.
Click to hide internal directories.