blake2

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package blake2 implements the functions, types, and interfaces for the module.

Index

Constants

View Source
const (
	MinKeyLength = 16
	MaxKeyLength = 64
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *types.Config

func NewBlake2

func NewBlake2(algSpec types.Spec, config *types.Config) (scheme.Scheme, error)

func NewBlake2b256

func NewBlake2b256(config *types.Config) (scheme.Scheme, error)

NewBlake2b256 creates a new BLAKE2b crypto instance

func NewBlake2b384

func NewBlake2b384(config *types.Config) (scheme.Scheme, error)

NewBlake2b384 creates a new BLAKE2b crypto instance

func NewBlake2b512

func NewBlake2b512(config *types.Config) (scheme.Scheme, error)

NewBlake2b512 creates a new BLAKE2b crypto instance

func NewBlake2s128

func NewBlake2s128(config *types.Config) (scheme.Scheme, error)

NewBlake2s128 creates a new BLAKE2s crypto instance

func NewBlake2s256

func NewBlake2s256(config *types.Config) (scheme.Scheme, error)

NewBlake2s256 creates a new BLAKE2s crypto instance

func ResolveSpec added in v1.1.0

func ResolveSpec(p types.Spec) (types.Spec, error)

func WithKey added in v1.1.0

func WithKey(key []byte) func(config *types.Config)

WithKey is an option to set the key for blake2 hashing. It operates on the new Config model by directly modifying the Params map.

Types

type Blake2

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

Blake2 implements the BLAKE2 hashing algorithm

func (*Blake2) Hash

func (c *Blake2) Hash(password string) (*types.HashParts, error)

Hash implements the hash method

func (*Blake2) HashWithSalt

func (c *Blake2) HashWithSalt(password string, salt []byte) (*types.HashParts, error)

HashWithSalt implements the hash with salt method

func (*Blake2) Spec added in v1.1.0

func (c *Blake2) Spec() types.Spec

func (*Blake2) Verify

func (c *Blake2) Verify(parts *types.HashParts, password string) error

Verify implements the verify method

type Params

type Params struct {
	Key []byte
}

func DefaultParams

func DefaultParams() *Params

func (*Params) FromMap

func (p *Params) FromMap(params map[string]string) error

func (*Params) IsNil added in v1.1.0

func (p *Params) IsNil() bool

func (*Params) String

func (p *Params) String() string

String returns the string representation of parameters

func (*Params) ToMap

func (p *Params) ToMap() map[string]string

ToMap converts Params to a map[string]string

func (*Params) Validate

func (p *Params) Validate(config *types.Config) error

Validate checks the parameters for correctness. It now only validates the key length.

Jump to

Keyboard shortcuts

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