Documentation ¶
Index ¶
Constants ¶
View Source
const ( AlgoSha1 = "sha1" AlgoSha256 = "sha256" AlgoSha512 = "sha512" )
List of supported algorithms
Variables ¶
View Source
var ( ErrBadSize = errors.New("aspnetpass: bad size") ErrBadSaltLen = errors.New("aspnetpass: bad salt length") ErrBadKeyLen = errors.New("aspnetpass: bad key length") ErrBadVersion = errors.New("aspnetpass: bad version") ErrBadAlgorithm = errors.New("aspnetpass: bad algorithm") ErrBadIteration = errors.New("aspnetpass: bad iteration") )
List of errors
Functions ¶
Types ¶
type Hasher ¶
Hasher is the interface that wraps the basic Hash method
var DefaultHasher Hasher = &hasherV3{ sg: rand.New(rand.NewSource(time.Now().UnixNano())), iter: 10000, slen: 16, klen: 32, algo: AlgoSha256, }
DefaultHasher is the .Net password hasher v3 with default configuration
func NewHasherV2 ¶
func NewHasherV2(sg SaltGenerator) (Hasher, error)
NewHasherV2 returns a new HasherV2 instance
func NewHasherV3 ¶
func NewHasherV3(iter, saltLen, keyLen int, algo string, sg SaltGenerator) (Hasher, error)
NewHasherV3 returns a new HasherV3 instance with salt length of saltLen bytes, minimum 16 byte key length of keyLen bytes, minimum 32 byte algo should be one of the sha1, sha256 or sha512
type SaltGenerator ¶
SaltGenerator is the interface that generates salt
Read generates len(p) bytes it should return the len(p) and a nil error otherwise 0, error
Click to show internal directories.
Click to hide internal directories.