security

package
v0.0.0-...-0d86eac Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHash

func CompareHash(ctx context.Context, method string, currentHash []byte, password []byte, salt []byte) bool

CompareHash compares a hash with a password. It returns true if the password matches the hash.

func HashWithSalt

func HashWithSalt(ctx context.Context, password []byte, salt []byte) (string, []byte)

HashWithSalt returns the used method as string and a hash of the given password with the salt prepended. Per default, the hash is an argon2 hash.

func HashWithSaltArgon2

func HashWithSaltArgon2(ctx context.Context, password []byte, salt []byte) (string, []byte)

HashWithSaltArgon2 returns the used method as string and an argon2 hash of the given password with the salt prepended.

func HashWithSaltSHA256

func HashWithSaltSHA256(ctx context.Context, password []byte, salt []byte) (string, []byte)

HashWithSaltSHA256 returns the used method as string and a sha256 hash of the given password with the salt prepended.

func HashWithSaltSHA512

func HashWithSaltSHA512(ctx context.Context, password []byte, salt []byte) (string, []byte)

HashWithSaltSHA512 returns the used method as string and a sha512 hash of the given password with the salt prepended.

func RandomCode

func RandomCode(n int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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