Documentation
¶
Overview ¶
Package passhash hashes and verifies argon2id passwords in the PHC string format "$argon2id$v=19$m=...,t=...,p=...$salt$hash", shared by the account service's player passwords and the admin package's operator passwords.
Index ¶
Constants ¶
const ( // MaxTime is the most passes over memory. MaxTime = 16 // MaxMemoryKiB is the most memory one hash uses, in KiB: 4 GiB. MaxMemoryKiB = 4 << 20 // MaxThreads is the most lanes. MaxThreads = 16 // SaltLen is the length of the random salt Hash draws, in bytes. SaltLen = 16 // KeyLen is the length of the hash Hash derives, in bytes. KeyLen = 32 )
Bounds of a hash's cost. Parse refuses a hash outside them, so a tampered record cannot make a check exhaust memory.
Variables ¶
var ErrFormat = errors.New("passhash: malformed password hash")
ErrFormat reports a string that is not an argon2id hash within the bounds above.
Functions ¶
Types ¶
type Params ¶
type Params struct {
// Time is the number of passes over memory, 1 to MaxTime.
Time uint32
// MemoryKiB is the memory one hash uses, in KiB, from 8*Threads to MaxMemoryKiB.
MemoryKiB uint32
// Threads is the parallelism (lanes), 1 to MaxThreads.
Threads uint8
}
Params is the cost of a hash.
func Cost ¶
Cost returns the cost encoded was made with, or ErrFormat when it is not a well-formed argon2id hash within the bounds, without computing the hash.