Documentation ¶
Index ¶
- func CompareHash(ctx context.Context, method string, currentHash []byte, password []byte, ...) bool
- func HashWithSalt(ctx context.Context, password []byte, salt []byte) (string, []byte)
- func HashWithSaltArgon2(ctx context.Context, password []byte, salt []byte) (string, []byte)
- func HashWithSaltSHA256(ctx context.Context, password []byte, salt []byte) (string, []byte)
- func HashWithSaltSHA512(ctx context.Context, password []byte, salt []byte) (string, []byte)
- func RandomCode(n int) string
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 ¶
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 ¶
HashWithSaltArgon2 returns the used method as string and an argon2 hash of the given password with the salt prepended.
func HashWithSaltSHA256 ¶
HashWithSaltSHA256 returns the used method as string and a sha256 hash of the given password with the salt prepended.
func HashWithSaltSHA512 ¶
HashWithSaltSHA512 returns the used method as string and a sha512 hash of the given password with the salt prepended.
func RandomCode ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.