go-hmaccrypt: github.com/patrickmn/go-hmaccrypt Index | Files

package hmaccrypt

import "github.com/patrickmn/go-hmaccrypt"

Index

Package Files

hmaccrypt.go

type HmacCrypt Uses

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

func New Uses

func New(hash func() hash.Hash, pepper []byte) *HmacCrypt

Returns a HmacCrypt using the specified hash (e.g. sha512.New) and pepper for its HMAC function. The pepper should be stored separately from the returned digests. If the digests are stored in a database, it is a good idea to store the pepper on the disk, or as a constant in the application itself.

func (*HmacCrypt) Bcrypt Uses

func (c *HmacCrypt) Bcrypt(password []byte, cost int) ([]byte, error)

Generates a new bcrypt(HMAC-hash(password, pepper), salt(cost)) digest of a password with a given bcrypt cost/work factor, e.g. 10 (bcrypt.DefaultCost). Use BcryptCompare to compare a password to an existing digest.

func (*HmacCrypt) BcryptCompare Uses

func (c *HmacCrypt) BcryptCompare(digest, password []byte) error

Compares an existing bcrypt digest to HMAC-hash(password, pepper). Returns an error if there is no match.

Package hmaccrypt imports 4 packages (graph). Updated 2016-07-18. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).