passwords

package module
v0.0.0-...-7a030d3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: BSD-3-Clause Imports: 0 Imported by: 0

README

Go Passwords

A package of properly modified password hashing algorithms that cooperate with other Goroutines. Ideal for building web servers doing password hashing.

Please read Go and passwords for more information on why you should use this package instead of:

  • golang.org/x/crypto/argon2
  • golang.org/x/crypto/bcrypt
  • golang.org/x/crypto/scrypt
  • golang.org/x/crypto/pbkdf2

How to use

Instead of using golang.org/x/crypto use github.com/hf/passwords. You'll find argon2, bcrypt, scrypt, and pbkdf2 as supbackages.

These packages expose the same API as the native implementation, but also add WithContext methods which allow you to cancel / timeout password hashing.

Inside the metrics package you will find some useful metrics:

  • NumOutstanding() is the number of password hashing runs waiting in a queue.
  • DurationMovingAverage4() is a 4-point moving average of the duration of password hashing runs.
  • DurationQueue() gives you the duration likely needed to clear out the current queue of runs.

You can use these to implement better auto-scaling strategies, as well as give you the ability to reject new password hashing runs if the system is too full to handle them.

Security

Please reach out to me directly over email sdimitrovski@gmail.com. Note that the algorithms are as-implemented by the Go Authors, so be sure to also submit a report there.

License

Copyright © 2009-2022 The Go Authors and Stojan Dimitrovski. All rights reserved.

See LICENSE for the full text. It's a BSD-style license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package argon2 implements the key derivation function Argon2.
Package argon2 implements the key derivation function Argon2.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf).
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf).

Jump to

Keyboard shortcuts

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