hash

package
v0.0.0-...-554d062 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hash implements key generation and password hashing operations.

Index

Constants

View Source
const DigestSize = 64

Variables

This section is empty.

Functions

func Keygen

func Keygen() ([]byte, error)

Keygen generates a cryptographically secure key of given size.

func Password

func Password(pass, salt []byte) ([]byte, error)

Password hashes a given password with a given salt. It returns an hash of the given size.

func PasswordCompare

func PasswordCompare(pass, salt, hashedPass []byte) error

PasswordCompare allows comparison between a given password and a given hashed password.

Returns true if after hashing the given password with the given salt the output hash of the given size is equal to the given hashed password. Else returns false.

Types

type MismatchErr

type MismatchErr string
const ErrMismatchedHashandPassword MismatchErr = "the hashed password does not match the hash of the given password"

ErrMismatchedHashAndPassword is returned when a password (hashed) and given hash do not match.

func (MismatchErr) Error

func (e MismatchErr) Error() string

Jump to

Keyboard shortcuts

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