utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultArgon2HashingParams = &Argon2HashingParam{
	memory:      64 * 1024,
	iterations:  3,
	parallelism: 4,
	saltLength:  16,
	keyLength:   32,
}
View Source
var ErrIncompatibleVersion = errors.New("incompatible version of argon2")
View Source
var ErrInvalidHash = errors.New("the encoded hash is not in the correct format")

Functions

func Base64

func Base64(dst, src []byte)

func Base64String

func Base64String(b []byte) string

func Base64StringDecode

func Base64StringDecode(s string) ([]byte, error)

func Base64StringDecodeToString

func Base64StringDecodeToString(s string) (string, error)

func Base64URL

func Base64URL(dst, src []byte)

func Base64URLString

func Base64URLString(b []byte) string

func Base64URLStringBulkDecode added in v0.0.2

func Base64URLStringBulkDecode(s ...string) ([][]byte, error)

func Base64URLStringDecode

func Base64URLStringDecode(s string) ([]byte, error)

func Base64URLStringDecodeToString

func Base64URLStringDecodeToString(s string) (string, error)

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CheckPasswordHashWithArgon2

func CheckPasswordHashWithArgon2(password, encodedHash string) (match bool, err error)

func HashPassword

func HashPassword(password string) (string, error)

func HashPasswordWithArgon2

func HashPasswordWithArgon2(password string, params *Argon2HashingParam) (string, error)

func HashString

func HashString(plaintext string, alg crypto.Hash) []byte

func HashStringToBase64

func HashStringToBase64(plaintext string, alg crypto.Hash) string

func HashStringToBase64URL

func HashStringToBase64URL(plaintext string, alg crypto.Hash) string

func HashStringToHex

func HashStringToHex(plaintext string, alg crypto.Hash) string

func JSONMapper

func JSONMapper(src interface{}, dest interface{}) error

func RandomBytes

func RandomBytes(n uint64) ([]byte, error)

Types

type Argon2HashingParam

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

Jump to

Keyboard shortcuts

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