Documentation ¶
Index ¶
- Variables
- func Base64Decode(src []byte) ([]byte, error)
- func Base64DecodeNotStrict(src []byte) ([]byte, error)
- func Base64Encode(src []byte) []byte
- func DecodeDecimalString(s string, strict bool, bitSize int) (int64, error)
- func DecodeUnsignedString(s string, strict bool, bitSize int) (uint64, error)
- func NewMismatchedFunctionNameError(gotName string, expectedNames ...string) error
- func NoValueValidator(value string) error
- func ValueCharacterValidator(value string) error
- type Argon2PHC
- type Base64Decoder
- type Base64Encoder
- type DefaultBase64Handler
- type PHCError
- type PHCInstance
- type PHCParameterDescription
- type PHCParser
- type PHCSchema
- type ParameterValuePair
- type ScryptPHC
- type ValueValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNonOptionalParameterMissing = errors.New("non optional parameter is missing") ErrParameterValueValidation = errors.New("validation of parameter failed") ErrMismatchedFunctionName = errors.New("invalid function name") ErrUnmatchedParameterName = errors.New("unmatched parameter parsed") )
View Source
var ( ErrInvalidPHCStructure = errors.New("invalid phc syntax") ErrInvalidFunctionName = errors.New("invalid function name") ErrInvalidParameterName = errors.New("invalid parameter name") ErrInvalidParameterValue = errors.New("invalid parameter value") ErrMissingParameterValue = errors.New("no value for parameter given") ErrBase64Decode = errors.New("error decoding base64") )
View Source
var Argon2Schema = &PHCSchema{ FunctionNames: Argon2Variants, ParameterDescriptions: []*PHCParameterDescription{ { Name: "v", Default: strconv.FormatUint(uint64(defaultArgon2Version), 10), Optional: true, ValidateValue: NoValueValidator, }, { Name: "m", Default: "", Optional: false, ValidateValue: NoValueValidator, }, { Name: "t", Default: "", Optional: false, ValidateValue: NoValueValidator, }, { Name: "p", Default: "", Optional: false, ValidateValue: NoValueValidator, }, }, Decoder: DefaultBase64, }
View Source
var Argon2Variants = []string{
"argon2id",
"argon2i",
"argon2d",
}
View Source
var Argon2Versions = []uint32{
0x10,
0x13,
}
View Source
var DefaultBase64 = NewDefaultBase64Handler(true)
View Source
var (
ErrInvalidArgon2Version = errors.New("invalid argon2 version")
)
View Source
var (
NonMinimalDecimalEncoding = errors.New("not the minimal decimal encoding")
)
View Source
var ScryptPHCSchema = &PHCSchema{ FunctionNames: []string{"scrypt"}, ParameterDescriptions: []*PHCParameterDescription{ { Name: "ln", Default: "", Optional: false, ValidateValue: NoValueValidator, }, { Name: "r", Default: "", Optional: false, ValidateValue: NoValueValidator, }, { Name: "p", Default: "", Optional: false, ValidateValue: NoValueValidator, }, }, Decoder: DefaultBase64, }
Functions ¶
func Base64Decode ¶
Base64Decode decodes the source using the alphabet.
func Base64DecodeNotStrict ¶
Base64DecodeNotStrict decodes the source using the alphabet.
In contrast to Base64Decode this method also allows non-zero trailing padding bits.
func Base64Encode ¶
Base64Encode encodes the source to base64 using the alphabet.
func DecodeDecimalString ¶
func DecodeUnsignedString ¶
func NoValueValidator ¶
func ValueCharacterValidator ¶
Types ¶
type Base64Decoder ¶
type Base64Encoder ¶
type DefaultBase64Handler ¶
type DefaultBase64Handler struct {
Strict bool
}
func NewDefaultBase64Handler ¶
func NewDefaultBase64Handler(strict bool) DefaultBase64Handler
func (DefaultBase64Handler) Base64Decode ¶
func (h DefaultBase64Handler) Base64Decode(src []byte) ([]byte, error)
func (DefaultBase64Handler) Base64Encode ¶
func (h DefaultBase64Handler) Base64Encode(src []byte) []byte
type PHCError ¶
func NewPHCError ¶
type PHCInstance ¶
type PHCParameterDescription ¶
type PHCParameterDescription struct { Name string Default string Optional bool ValidateValue ValueValidatorFunc }
func (*PHCParameterDescription) GetValueValidatorFunc ¶
func (description *PHCParameterDescription) GetValueValidatorFunc() ValueValidatorFunc
type PHCParser ¶
type PHCParser struct {
MinFunctionNameLength, MaxFunctionNameLength int
MinParameterNameLength, MaxParameterNameLength int
MinParameterValueLength, MaxParameterValueLength int
Decoder Base64Decoder
}
func NewPHCParser ¶
func NewPHCParser() *PHCParser
type PHCSchema ¶
type PHCSchema struct { FunctionNames []string ParameterDescriptions []*PHCParameterDescription Decoder Base64Decoder }
type ParameterValuePair ¶
type ScryptPHC ¶
type ScryptPHC struct { // The cost parameter N Cost int // Block size parameter r BlockSize int // The parallelism parameter p Parallelism int Salt []byte SaltString string Hash []byte HashString string }
func DecodeScrypt ¶
func (*ScryptPHC) ValidateParameters ¶
type ValueValidatorFunc ¶
Click to show internal directories.
Click to hide internal directories.