pwhash

package
v0.0.0-...-f08c318 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2020 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Argon2i_Alg                 = 1
	Argon2i_BytesMin            = 16
	Argon2i_BytesMax            = math.MaxUint32
	Argon2i_PasswdMin           = 0
	Argon2i_PasswdMax           = 4294967295
	Argon2i_MemLimitMin         = 8192
	Argon2i_MemLimitMax         = 4398046510080
	Argon2i_MemLimitInteractive = 33554432
	Argon2i_MemLimitModerate    = 134217728
	Argon2i_MemLimitSensitive   = 536870912
	Argon2i_OpsLimitMin         = 3
	Argon2i_OpsLimitMax         = 4294967295
	Argon2i_OpsLimitInteractive = 4
	Argon2i_OpsLimitModerate    = 6
	Argon2i_OpsLimitSensitive   = 8
	Argon2i_SaltBytes           = 16
	Argon2i_StrBytes            = 128
	Argon2i_StrPrefix           = "$argon2i$"
)
View Source
const (
	Argon2id_Alg                 = 2
	Argon2id_BytesMin            = 16
	Argon2id_BytesMax            = math.MaxUint32
	Argon2id_PasswdMin           = 0
	Argon2id_PasswdMax           = 4294967295
	Argon2id_MemLimitMin         = 8192
	Argon2id_MemLimitMax         = 4398046510080
	Argon2id_MemLimitInteractive = 67108864
	Argon2id_MemLimitModerate    = 268435456
	Argon2id_MemLimitSensitive   = 1073741824
	Argon2id_OpsLimitMin         = 1
	Argon2id_OpsLimitMax         = 4294967295
	Argon2id_OpsLimitInteractive = 2
	Argon2id_OpsLimitModerate    = 3
	Argon2id_OpsLimitSensitive   = 4
	Argon2id_SaltBytes           = 16
	Argon2id_StrBytes            = 128
	Argon2id_StrPrefix           = "$argon2id$"
)
View Source
const (
	Primitive           = "argon2id"
	AlgArgon2i          = Argon2i_Alg
	AlgArgon2id         = Argon2id_Alg
	AlgDefault          = AlgArgon2id
	BytesMin            = Argon2i_BytesMin
	BytesMax            = Argon2i_BytesMax
	PasswdMin           = Argon2i_PasswdMin
	PasswdMax           = Argon2i_PasswdMax
	MemLimitMin         = Argon2i_MemLimitMin
	MemLimitMax         = Argon2i_MemLimitMax
	MemLimitInteractive = Argon2i_MemLimitInteractive
	MemLimitModerate    = Argon2i_MemLimitModerate
	MemLimitSensitive   = Argon2i_MemLimitSensitive
	OpsLimitMin         = Argon2i_OpsLimitMin
	OpsLimitMax         = Argon2i_OpsLimitMax
	OpsLimitInteractive = Argon2i_OpsLimitInteractive
	OpsLimitModerate    = Argon2i_OpsLimitModerate
	OpsLimitSensitive   = Argon2i_OpsLimitSensitive
	SaltBytes           = Argon2i_SaltBytes
	StrBytes            = Argon2i_StrBytes
	StrPrefix           = Argon2i_StrPrefix
)
View Source
const (
	Scrypt_BytesMin            = 16
	Scrypt_BytesMax            = 0x1fffffffe0
	Scrypt_PasswdMin           = 0
	Scrypt_PasswdMax           = math.MaxUint32
	Scrypt_MemLimitMin         = 16777216
	Scrypt_MemLimitMax         = 68719476736
	Scrypt_MemLimitInteractive = 16777216
	Scrypt_MemLimitSensitive   = 1073741824
	Scrypt_OpsLimitMin         = 32768
	Scrypt_OpsLimitMax         = 4294967295
	Scrypt_OpsLimitInteractive = 524288
	Scrypt_OpsLimitSensitive   = 33554432
	Scrypt_SaltBytes           = 32
	Scrypt_StrBytes            = 102
	Scrypt_StrPrefix           = "$7$"
)

Variables

View Source
var (
	ErrWrongAlg      = errors.New("wrong algorithm identifier found")
	ErrWrongPassword = errors.New("wrong password entered")
)

Functions

func NeedsRehash

func NeedsRehash(h string, opslimit, memlimit uint64) (rehash bool)

NeedsRehash

func New

func New(pw []byte) (ph godium.PwHash)

New

func NewScrypt

func NewScrypt(pw []byte) (ph godium.PwHash)

NewScrypt creates a new instance of Scrypt with pw as the given password.

Types

type Argon2i

type Argon2i struct {
	// contains filtered or unexported fields
}

Argon2i

func NewArgon2i

func NewArgon2i(pw []byte) (a *Argon2i)

NewArgon2i

func (*Argon2i) BytesMax

func (pw *Argon2i) BytesMax() int

func (*Argon2i) BytesMin

func (pw *Argon2i) BytesMin() int

func (*Argon2i) Hash

func (pw *Argon2i) Hash(dst, salt []byte, out, opslimit, memlimit uint64) (h []byte)

Hash implements godium.PwHash.

func (*Argon2i) HashParallel

func (pw *Argon2i) HashParallel(dst, salt []byte, out, opslimit, memlimit uint64, threads uint8) (h []byte)

HashParallel functions like Hash, but accepts an additional parameter that specifies the level of parallelism for the generation of the hash.

func (*Argon2i) MemLimitInteractive

func (pw *Argon2i) MemLimitInteractive() int

func (*Argon2i) MemLimitMax

func (pw *Argon2i) MemLimitMax() int

func (*Argon2i) MemLimitMin

func (pw *Argon2i) MemLimitMin() int

func (*Argon2i) MemLimitModerate

func (pw *Argon2i) MemLimitModerate() int

func (*Argon2i) MemLimitSensitive

func (pw *Argon2i) MemLimitSensitive() int

func (*Argon2i) OpsLimitInteractive

func (pw *Argon2i) OpsLimitInteractive() int

func (*Argon2i) OpsLimitMax

func (pw *Argon2i) OpsLimitMax() int

func (*Argon2i) OpsLimitMin

func (pw *Argon2i) OpsLimitMin() int

func (*Argon2i) OpsLimitModerate

func (pw *Argon2i) OpsLimitModerate() int

func (*Argon2i) OpsLimitSensitive

func (pw *Argon2i) OpsLimitSensitive() int

func (*Argon2i) PasswdMax

func (pw *Argon2i) PasswdMax() int

func (*Argon2i) PasswdMin

func (pw *Argon2i) PasswdMin() int

func (*Argon2i) SaltBytes

func (pw *Argon2i) SaltBytes() int

func (*Argon2i) Str

func (pw *Argon2i) Str(dst []byte, opslimit, memlimit uint64) (h []byte)

Str implements godium.PwHash.

func (*Argon2i) StrBytes

func (pw *Argon2i) StrBytes() int

func (*Argon2i) StrParallel

func (pw *Argon2i) StrParallel(dst []byte, opslimit, memlimit uint64, threads uint8) (h []byte)

StrParallel functions like Str, but accepts an additional parameter that specifies the level of parallelism for the generation of the hash string.

func (*Argon2i) StrPrefix

func (pw *Argon2i) StrPrefix() string

func (*Argon2i) StrVerify

func (pw *Argon2i) StrVerify(h []byte) (valid bool)

StrVerify implements godium.PwHash.

func (*Argon2i) StrVerifyParallel

func (pw *Argon2i) StrVerifyParallel(h []byte, threads uint8) (valid bool)

StrVerifyParallel functions like StrVerify, but accepts an additional parameter that specifies the level of parallelism for the verification of the hash.

func (*Argon2i) Wipe

func (pw *Argon2i) Wipe()

Wipe implements godium.PwHash.

type Argon2id

type Argon2id struct {
	// contains filtered or unexported fields
}

func (*Argon2id) BytesMax

func (pw *Argon2id) BytesMax() int

func (*Argon2id) BytesMin

func (pw *Argon2id) BytesMin() int

func (*Argon2id) MemLimitInteractive

func (pw *Argon2id) MemLimitInteractive() int

func (*Argon2id) MemLimitMax

func (pw *Argon2id) MemLimitMax() int

func (*Argon2id) MemLimitMin

func (pw *Argon2id) MemLimitMin() int

func (*Argon2id) MemLimitModerate

func (pw *Argon2id) MemLimitModerate() int

func (*Argon2id) MemLimitSensitive

func (pw *Argon2id) MemLimitSensitive() int

func (*Argon2id) OpsLimitInteractive

func (pw *Argon2id) OpsLimitInteractive() int

func (*Argon2id) OpsLimitMax

func (pw *Argon2id) OpsLimitMax() int

func (*Argon2id) OpsLimitMin

func (pw *Argon2id) OpsLimitMin() int

func (*Argon2id) OpsLimitModerate

func (pw *Argon2id) OpsLimitModerate() int

func (*Argon2id) OpsLimitSensitive

func (pw *Argon2id) OpsLimitSensitive() int

func (*Argon2id) PasswdMax

func (pw *Argon2id) PasswdMax() int

func (*Argon2id) PasswdMin

func (pw *Argon2id) PasswdMin() int

func (*Argon2id) SaltBytes

func (pw *Argon2id) SaltBytes() int

func (*Argon2id) StrBytes

func (pw *Argon2id) StrBytes() int

func (*Argon2id) StrPrefix

func (pw *Argon2id) StrPrefix() string

type Scrypt

type Scrypt struct {
	// contains filtered or unexported fields
}

Scrypt implements godium.PwHash, based on the Scrypt password hashing function.

func (*Scrypt) BytesMax

func (pw *Scrypt) BytesMax() int

func (*Scrypt) BytesMin

func (pw *Scrypt) BytesMin() int

func (*Scrypt) Hash

func (pw *Scrypt) Hash(dst, salt []byte, out, opslimit, memlimit uint64) (h []byte, err error)

Hash

func (*Scrypt) MemLimitInteractive

func (pw *Scrypt) MemLimitInteractive() int

func (*Scrypt) MemLimitMax

func (pw *Scrypt) MemLimitMax() int

func (*Scrypt) MemLimitMin

func (pw *Scrypt) MemLimitMin() int

func (*Scrypt) MemLimitModerate

func (pw *Scrypt) MemLimitModerate() int

func (*Scrypt) MemLimitSensitive

func (pw *Scrypt) MemLimitSensitive() int

func (*Scrypt) OpsLimitInteractive

func (pw *Scrypt) OpsLimitInteractive() int

func (*Scrypt) OpsLimitMax

func (pw *Scrypt) OpsLimitMax() int

func (*Scrypt) OpsLimitMin

func (pw *Scrypt) OpsLimitMin() int

func (*Scrypt) OpsLimitModerate

func (pw *Scrypt) OpsLimitModerate() int

func (*Scrypt) OpsLimitSensitive

func (pw *Scrypt) OpsLimitSensitive() int

func (*Scrypt) PasswdMax

func (pw *Scrypt) PasswdMax() int

func (*Scrypt) PasswdMin

func (pw *Scrypt) PasswdMin() int

func (*Scrypt) SaltBytes

func (pw *Scrypt) SaltBytes() int

func (*Scrypt) Str

func (pw *Scrypt) Str(dst []byte, opslimit, memlimit uint64) (h []byte, err error)

Str

func (*Scrypt) StrBytes

func (pw *Scrypt) StrBytes() int

func (*Scrypt) StrPrefix

func (pw *Scrypt) StrPrefix() string

func (*Scrypt) StrVerify

func (pw *Scrypt) StrVerify(stored []byte) (err error)

StrVerify

func (*Scrypt) Wipe

func (pw *Scrypt) Wipe()

Wipe implements godium.PwHash.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL