Documentation ¶
Overview ¶
Package password implements convenience types and functions for dealing with passwords. The default parameters are based on recommendations for interactive use and should be okay. In its simplest form you just use the default parameters to hash passwords:
hash, err := HashWithParam(DefaultInteractiveParameters, "mySecretPassword")
Then to verify the hash you can do
res, err := Verify(hash, "mySecretPassword")
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Hash ¶
Hash a password with the default parameters. The returned byte slice is a serialized hash including the parameters.
You should prefer to use this unless you have given the parameters some thought since we will try to maintain the DefaultInteractiveParameters and ensure they have appropriate values.
func HashWithParam ¶
HashWithParam hashes a password with a given parameter set. The returned byte slice is a serialized hash including the parameters.
Returns an error if rand.Read fails - which it shouldn't.
Types ¶
type ParsedParams ¶
type ParsedParams struct { Version int Time uint32 Memory uint32 Threads uint8 Salt []byte Hash []byte }
ParsedParams represents the parameters extracted from the serialized hash.
func DecodeParamsFromHash ¶
func DecodeParamsFromHash(hash []byte) (*ParsedParams, error)
DecodeParamsFromHash decodes the passwod hashing parameters from the serialized password hash.