mhf

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 7 Imported by: 0

README

MHF - Memory Hard Functions

This package offers a single interface to common and standard memory-hard functions, also used as key derivation functions. It completely relies on built-ins, so there's no change in implementations.

It's main intent is to offer abstraction of the underlying function and simply refer to it by an identifier, as well as to encode and back up a configuration of the parameters.

Supported Memory-Hard Functions (or Key Derivation Functions are):

  • Argon2 family
  • Scrypt
  • PBKDF2

Features

Identifiers Parameters

|

Documentation

Overview

Package mhf provides an interface to memory hard functions, a.k.a password key derivation functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identifier

type Identifier byte

Identifier is used to specify the memory hard function to be used.

const (
	// Argon2id password kdf function.
	Argon2id Identifier = 1 + iota

	// Scrypt password kdf function.
	Scrypt

	// PBKDF2Sha512 PBKDF2 password kdf function using SHA-512.
	PBKDF2Sha512

	// Bcrypt password kdf function.
	Bcrypt
)

func (Identifier) Available

func (i Identifier) Available() bool

Available reports whether the given kdf function is linked into the binary.

func (Identifier) Get

func (i Identifier) Get() *MHF

Get returns an MHF with default parameters.

func (Identifier) Harden

func (i Identifier) Harden(password, salt []byte, length int) []byte

Harden uses default parameters for the key derivation function over the input password and salt.

func (Identifier) String

func (i Identifier) String() string

String returns the string name of the hashing function.

type MHF

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

MHF allows customisation of the underlying memory-hard function.

func (*MHF) Set

func (m *MHF) Set(i Identifier) *MHF

Set sets m's memory-hard function to the specified one and returns m. Returns nil if the identifier is invalid.

Jump to

Keyboard shortcuts

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