krypt

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("argon2-incorrect-hash")
	ErrIncompatibleVersion = errors.New("argon2-incorrect-version")
)
View Source
var DefaultParams = &Params{
	memory:      64 * 1024,
	iterations:  3,
	parallelism: 2,
	saltLength:  16,
	keyLength:   32,
}
View Source
var (
	ErrInvalidNonceSize = errors.New("krypt-invalid-nonce-size")
)

Functions

func CompareHash

func CompareHash(password, hash string) (match bool, err error)

func HashPassword

func HashPassword(str string) (string, error)

func HashWithParams

func HashWithParams(str string, params *Params) (string, error)

func RandomBase64String

func RandomBase64String(size uint32) (string, error)

func RandomBytes

func RandomBytes(size uint32) ([]byte, error)

func RandomHexString

func RandomHexString(size uint32) (string, error)

Types

type Params

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

type SymSecret

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

func NewSymSecret

func NewSymSecret(secretKey string, salt string, iter, keyLen int) (*SymSecret, error)

func (*SymSecret) Compare

func (me *SymSecret) Compare(ciphertext string, plaintext string) (bool, error)

func (*SymSecret) Decrypt

func (me *SymSecret) Decrypt(str string) (string, error)

func (*SymSecret) Encrypt

func (me *SymSecret) Encrypt(str string) (string, error)

Jump to

Keyboard shortcuts

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