hasher

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Argon2i defines the argon2i hashing algorithm
	Argon2i = "argon2i"
	// BcryptBlake2b512 defines bcrypt+blake2b-512 hashing algorithm
	// BcryptBlake2b512 = "bcrypt+blake2b-512"
	// Pbkdf2Blake2b512 defines pbkdf2+blake2b-512 hashing algorithm
	Pbkdf2Blake2b512 = "pbkdf2+blake2b-512"
	// Pbkdf2Sha512 defines pbkdf2+sha512 hashing algorithm
	Pbkdf2Sha512 = "pbkdf2+sha512"
	// Pbkdf2Keccak512 defines pbkdf2+sha3-512 hashing algorithm
	Pbkdf2Keccak512 = "pbkdf2+sha3-512"
)

Variables

View Source
var Strategies = map[string]func([]byte) Strategy{
	Argon2i: func(salt []byte) Strategy {
		s, _ := newArgon2Deriver(salt)
		return s
	},

	Pbkdf2Blake2b512: func(salt []byte) Strategy {
		s, _ := newPbkdf2Deriver(func() hash.Hash {
			h, _ := blake2b.New512(nil)
			return h
		}, salt, 50000, blake2b.Size)
		return s
	},
	Pbkdf2Sha512: func(salt []byte) Strategy {
		s, _ := newPbkdf2Deriver(sha512.New, salt, 50000, sha512.Size)
		return s
	},
	Pbkdf2Keccak512: func(salt []byte) Strategy {
		s, _ := newPbkdf2Deriver(sha3.New512, salt, 50000, 64)
		return s
	},
}

Strategies defines available hashing strategies

Functions

This section is empty.

Types

type Strategy

type Strategy interface {
	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