hashing

package
v0.0.0-...-cde7464 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomSalt

func GenerateRandomSalt() (string, error)

GenerateRandomSalt generates random 32 bytes long salt

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

Hash is a structure which is capable of generating and comparing sha512 hashes derived from a string

func New

func New(peppers []string) *Hash

New creates a new hash and seeds with a list of peppers

func (*Hash) Compare

func (h *Hash) Compare(input, salt, hash string, withPepper bool) (bool, error)

Compare checks the input string against the salted hash. It'll loop through all peppers until finding success if the withPepper option is passed

func (*Hash) GenerateHash

func (h *Hash) GenerateHash(input string, withSalt, withPepper bool) (hash, salt string, err error)

GenerateHash hashes input string spiced up with salt and pepper using sha512.

Jump to

Keyboard shortcuts

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