Help us shape the future of Go! Take the 2026 Go Developer Survey

password

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package password hashes passwords and verifies passwords against hashes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) (string, error)

Hash returns a PBKDF2-HMAC-SHA256 hash of password in passlib's "$pbkdf2-sha256$<iterations>$<salt>$<key>" format.

func Validate

func Validate(hash string) error

Validate returns an error if Verify would return one for hash. Only checking a password against a hash fully establishes that the hash is usable, so Validate does that, and costs as much as a call to Verify.

func Verify

func Verify(hash, password string) (bool, error)

Verify reports whether password matches hash. hash may be a PBKDF2-HMAC-SHA256 hash in the format Hash returns, or a bcrypt hash. An error is returned if hash is in neither format, or if it is a bcrypt hash and Go's FIPS 140-3 mode is enabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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