Documentation
¶
Overview ¶
Package scrypt provides salt generation, hashing and verification for x/crypto/scrypt.
Index ¶
Constants ¶
View Source
const ( Identifier = "scrypt" Identifier_Linux = "7" Prefix = "$" + Identifier + "$" Prefix_Linux = "$" + Identifier_Linux + "$" )
Identifiers and prefixes that describe and scrypt encoded hash string.
View Source
const ( DefaultMinLN = 14 DefaultMaxLN = 20 DefaultMinR = 8 DefaultMaxR = 32 DefaultMinP = 1 DefaultMaxP = 16 )
Defaults for scrypt validation options.
View Source
const Format = "$%s$ln=%d,r=%d,p=%d$%s$%s"
Format of the Modular Crypt Format, as used by passlib. See https://passlib.readthedocs.io/en/stable/lib/passlib.hash.scrypt.html#format-algorithm
Variables ¶
View Source
var DefaultValidationOpts = &ValidationOpts{ MinLN: DefaultMinLN, MaxLN: DefaultMaxLN, MinR: DefaultMinR, MaxR: DefaultMaxR, MinP: DefaultMinP, MaxP: DefaultMaxP, }
View Source
var (
ErrRxPTooLarge = errors.New("scrypt: r*p value larger than 2^30")
)
View Source
var (
RecommendedParams = Params{
LN: 15,
R: 8,
P: 1,
KeyLen: 32,
SaltLen: 16,
}
)
Functions ¶
This section is empty.
Types ¶
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
func New ¶
func New(p Params, opts *ValidationOpts) *Hasher
type Params ¶
type Params struct {
LN int // log2 of N, the CPU/memory cost parameter
R int
P int
// Lengths for key output and desired salt.
KeyLen int
SaltLen uint32
}
Params holds the cost parameters for scrypt hashing. See scrypt.Key
type ValidationOpts ¶ added in v0.12.0
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶ added in v0.12.0
func NewVerifier(opts *ValidationOpts) *Verifier
Click to show internal directories.
Click to hide internal directories.