raw

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const RecommendedMemory uint32 = 32 * 1024

The current recommended memory for interactive logins.

View Source
const RecommendedThreads uint8 = 4

The current recommended number of threads for interactive logins.

View Source
const RecommendedTime uint32 = 4

The current recommended time value for interactive logins.

Variables

View Source
var ErrInvalidKeyValuePair = fmt.Errorf("invalid argon2 key-value pair")

Indicates that a key-value pair in the configuration part is malformed.

View Source
var ErrInvalidStub = fmt.Errorf("invalid argon2 password stub")

Indicates that a password hash or stub is invalid.

View Source
var ErrMissingMemory = fmt.Errorf("memory parameter (m) is missing")

Indicates that the memory parameter ("m") was mossing in the hash config part, even though it is required.

View Source
var ErrMissingParallelism = fmt.Errorf("parallelism parameter (p) is missing")

Indicates that the parallelism parameter ("p") was mossing in the hash config part, even though it is required.

View Source
var ErrMissingTime = fmt.Errorf("time parameter (t) is missing")

Indicates that the time parameter ("t") was mossing in the hash config part, even though it is required.

View Source
var ErrMissingVersion = fmt.Errorf("version parameter (v) is missing")

Indicates that the version parameter ("v") was missing in the version part, even though it is required.

View Source
var ErrParseConfig = fmt.Errorf("hash config section has wrong number of parameters")

Indicates that the hash config part had the wrong number of parameters.

View Source
var ErrParseVersion = fmt.Errorf("version section has wrong number of parameters")

Indicates that the version part had the wrong number of parameters.

Functions

func Argon2

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

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

password should be a UTF-8 plaintext password. salt should be a random salt value in binary form.

Time, memory, and threads are parameters to argon2.

Returns an argon2 encoded hash.

func Parse

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

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