crypt

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Algo_Argon2       = "Argon2"
	Argon2_Memory     = 524288
	Argon2_Operations = 4
	Argon2_Time       = 1
	Argon2_Threads    = 1
	Argon2_SaltBytes  = 8
	Argon2_StrBytes   = 128

	RandStringCharsetB58 = "abcdefghijkmnopqrstuvwxyz" +
		"ABCDEFGHJKLMNPQRSTUVWXYZ123456789" // Base58
	RandStringCharsetAZ = "abcdefghijklmnopqrstuvwxyz" // Only a-z
)

Variables

This section is empty.

Functions

func InitTlsPairCa

func InitTlsPairCa(hosts []string, ca_path, key_path, crt_path string) error

func RandBytes

func RandBytes(size int) (data []byte)

Create random bytes of specified size

func RandString

func RandString(size int) string

By default use base58

func RandStringCharset added in v0.7.0

func RandStringCharset(size int, charset string) string

Create random string of specified size

Types

type Hash

type Hash struct {
	Algo string
	Salt []byte
	Hash []byte
}

func Generate

func Generate(password string, salt []byte) (hash Hash)

Generate a salted hash for the input string

func (*Hash) IsEmpty

func (hash *Hash) IsEmpty() bool

func (*Hash) IsEqual

func (hash *Hash) IsEqual(password string) bool

Compare string to generated hash

Jump to

Keyboard shortcuts

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