security

package
v0.0.0-...-626c64f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, salt, hash string) bool

CheckPasswordHash checks if passwords match

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword takes a string password and returns a hash of it

Types

type Password

type Password struct {
	Hash string
	Salt string
}

Password object

func GeneratePassword

func GeneratePassword(password string) (*Password, error)

GeneratePassword does exactly that

Jump to

Keyboard shortcuts

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