crypto

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSalt

func GenerateSalt(saltSize int) (string, error)

GenerateSalt returns securely generated random bytes as a string. An error is returned if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GetPasswordProtectedForm

func GetPasswordProtectedForm(
	password, salt string,
	time, memory uint32,
	threads uint8, keyLen uint32) string

GetPasswordProtectedForm returns the protected form of the password using the salt and other provided parameters. The returned value is as follow: salt + hashedPassword Recommended parameters are time = 3 and memory = 32 * 1024

func IsPasswordValid

func IsPasswordValid(
	password, protectedForm string,
	saltLen int,
	time, memory uint32,
	threads uint8, keyLen uint32) bool

IsPasswordValid return true if the given password matches the given protected form, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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