1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
package scrypt
import (
"math"
)
const (
// EncodingFmt is the format of the encoded digest.
EncodingFmt = "$%s$ln=%d,r=%d,p=%d$%s$%s"
// EncodingFmtYescrypt is the format of the encoded digest.
EncodingFmtYescrypt = "$%s$%s$%s$%s"
// AlgName is the name for this algorithm.
AlgName = "scrypt"
// AlgNameYescrypt is the name for this algorithm's yescrypt variant.
AlgNameYescrypt = "yescrypt"
// KeyLengthMin is the minimum key length accepted.
KeyLengthMin = 1
// SaltLengthMin is the minimum salt length accepted.
SaltLengthMin = 8
// SaltLengthMax is the maximum salt length accepted.
SaltLengthMax = 1024
// IterationsMin is the minimum number of iterations accepted.
IterationsMin = 1
// IterationsMax is the maximum number of iterations accepted.
IterationsMax = 58
// IterationsDefault is the default number of iterations.
IterationsDefault = 16
// BlockSizeMin is the minimum block size accepted.
BlockSizeMin = 1
// BlockSizeMax is the maximum block size accepted.
BlockSizeMax = math.MaxInt / 256
// BlockSizeDefault is the default block size.
BlockSizeDefault = 8
// ParallelismMin is the minimum parallelism factor accepted.
ParallelismMin = 1
// ParallelismMax is the maximum parallelism factor accepted.
//
// Equation is based on the following text from RFC:
//
// The parallelization parameter p
// ("parallelizationParameter") is a positive integer less than or equal
// to ((2^32-1) * 32) / (128 * r).
//
// When r has a minimum of 1, this makes the equation ((2^32-1) * 32) / 128.
ParallelismMax = 1073741823
// ParallelismDefault is the default parallelism factor.
ParallelismDefault = ParallelismMin
)
const (
AlgIdentifier = AlgName
AlgIdentifierYescrypt = "y"
)
const (
oP = "p"
oR = "r"
oLN = "ln"
variantDefault = VariantScrypt
)
|