Documentation ¶
Index ¶
- Constants
- func CheckHashKey(pwd string, salt []byte, key []byte) (ok bool, err error)
- func GenerateRandomSalt() (salt []byte, err error)
- func IsPasswordAllowed(pwd string) (ok bool, err error)
- func MakeHashKey(pwd string, salt []byte) (key []byte, err error)
- func PackSymbols(symbols []rune) (ba []byte, err error)
- func UnpackBytes(ba []byte) (symbols []rune, err error)
Constants ¶
View Source
const ( ErrSymbolsCountIsNotMultipleOfFour = "number of symbols must be a multiple of four" ErrSymbolsCountTooShort = "too short" ErrSymbolIsForbidden = "symbol is forbidden: %s" ErrBytesCount = "number of bytes must be a multiple of three" ErrSaltLengthError = "salt length error" ErrRandomizer = "randomizer is broken" )
View Source
const ( FirstSymbol = ' ' // White Space. LastSymbol = '_' // Low Line. MinAllowedSymbol = FirstSymbol MaxAllowedSymbol = LastSymbol MinPasswordLength = 16 SaltLengthRequired = 1024 )
View Source
const ( Argon2Iterations = 8 Argon2Memory = 8 * 1024 // 8 MiB. Argon2Threads = 1 Argon2KeyLength = 1024 )
Variables ¶
This section is empty.
Functions ¶
func CheckHashKey ¶
CheckHashKey hashes the password and salt and compares it with another key.
func GenerateRandomSalt ¶
GenerateRandomSalt creates a random salt which may be used for hashing.
func IsPasswordAllowed ¶
IsPasswordAllowed checks if the specified password is allowed.
func MakeHashKey ¶
MakeHashKey hashes the password and its salt.
func PackSymbols ¶
PackSymbols packs each quad of symbols into three bytes.
func UnpackBytes ¶
UnpackBytes unpacks each triplet of bytes into four symbols.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.