yescrypt

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	PWXsimple = 2
	PWXgather = 4
	PWXrounds = 6
	Swidth    = 8
)

These were tunable at design time, but they must meet certain constraints

View Source
const (
	PWXbytes = PWXgather * PWXsimple * 8
	PWXwords = PWXbytes / 8
	Sbytes   = 3 * (1 << Swidth) * PWXsimple * 8
	Swords   = Sbytes / 8
	Smask    = (((1 << Swidth) - 1) * PWXsimple * 8)
)

Derived values. These were never tunable on their own.

Variables

This section is empty.

Functions

func Decode64 added in v0.4.1

func Decode64(src []byte) []byte

func DecodeSetting added in v0.4.1

func DecodeSetting(setting []byte) (flags, ln, r int, err error)

func Encode64 added in v0.4.1

func Encode64(src []byte) []byte

func EncodeSetting added in v0.4.1

func EncodeSetting(flags, ln, r int) []byte

func Hash

func Hash(password, setting []byte) ([]byte, error)

Hash computes yescrypt hash encoding given the password and existing yescrypt setting or full hash encoding. The salt and other parameters are decoded from setting. Currently supports (only a little more than) the subset of yescrypt parameters that libxcrypt can generate (as of libxcrypt 4.4.36).

func Key

func Key(password, salt []byte, N, r, p, keyLen int) ([]byte, error)

Key computes native yescrypt assuming reference yescrypt's current default flags (as of yescrypt 1.1.0), p=1 (which it currently requires), t=0, and no ROM. Example usage:

dk, err := yescrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)

The set of parameters accepted by Key will likely change in future versions of this Go module to support more yescrypt functionality.

Types

This section is empty.

Jump to

Keyboard shortcuts

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