hasher

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Argon2i defines the argon2i hashing algorithm
	Argon2i = "argon2i"
	//ScryptBlake2b512 defines scrypt+blake2b-512 hashing algorithm
	ScryptBlake2b512 = "scrypt+blake2b-512"
	// Pbkdf2HmacSha512 defines pbkdf2+hmac-sha512 hashing algorithm
	Pbkdf2HmacSha512 = "pbkdf2+hmac-sha512"
)

Variables

View Source
var Strategies = map[string]func(func() []byte) Strategy{
	Argon2i: func(salt func() []byte) Strategy {
		s, _ := newArgon2Deriver(salt())
		return s
	},
	ScryptBlake2b512: func(salt func() []byte) Strategy {
		s, _ := newScryptDeriver(func() hash.Hash {
			h, err := blake2b.New512(nil)
			if err != nil {
				panic(err.Error())
			}
			return h
		}, salt())
		return s
	},
	Pbkdf2HmacSha512: func(salt func() []byte) Strategy {
		s, _ := newPbkdf2Deriver(sha512.New, salt(), pbkdf2Iterations, sha512.Size)
		return s
	},
}

Strategies defines available hashing strategies

Functions

This section is empty.

Types

type Strategy

type Strategy interface {
	Prefix() string
	Hash([]byte) (string, error)
}

Strategy defines hash algorithm strategy contract

Jump to

Keyboard shortcuts

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