hashing

package
v0.0.0-...-b149654 Latest Latest
Warning

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

Go to latest
Published: May 7, 2017 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

GenerateRandomSalt generates a random string 32 bytes in length

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 string, salt string, withPepper bool, hash string) bool

Compare checks the string against the salted hash, will loop through all peppers until finding success.

func (*Hash) GenerateHash

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

GenerateHash hashes the input string using sha512 with a salt and pepper. returns the hash and the salt

Jump to

Keyboard shortcuts

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