raw

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package raw provides a raw implementation of the modular-crypt-wrapped Argon2i primitive.

Index

Constants

View Source
const (
	RecommendedTime    uint32 = 4         // Current recommended time value for interactive logins
	RecommendedMemory  uint32 = 32 * 1024 // Current recommended memory for interactive logins
	RecommendedThreads uint8  = 4         // Current recommended number of threads for interactive logins.
)

Variables

View Source
var (
	ErrInvalidStub         = errors.New("invalid argon2 password stub")
	ErrMissingTime         = errors.New("time parameter (t) is missing")
	ErrParseConfig         = errors.New("hash config section has wrong number of parameters")
	ErrParseVersion        = errors.New("version section has wrong number of parameters")
	ErrMissingMemory       = errors.New("memory parameter (m) is missing")
	ErrMissingVersion      = errors.New("version parameter (v) is missing")
	ErrMissingParallelism  = errors.New("parallelism parameter (p) is missing")
	ErrInvalidKeyValuePair = errors.New("invalid argon2 key-value pair")
)

Functions

func Argon2

func Argon2(password string, salt []byte, time, memory uint32, threads uint8) string

Wrapper for golang.org/x/crypto/argon2 that implements a sensible hashing interface.

password must be in UTF-8 format. salt must be a random salt value in binary form. time, memory and threads are parameters for argon2.

Returns hash in argon2 encoding.

func Parse

func Parse(stub string) (salt, hash []byte, version int, time, memory uint32, parallelism uint8, err error)

Parse parses an argon2 encoded hash. The format is as follows:

    $argon2i$v=version$m=memory,t=time,p=threads$salt$hash   // hash
	$argon2i$v=version$m=memory,t=time,p=threads$salt        // stub

Types

This section is empty.

Jump to

Keyboard shortcuts

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