pash

package module
v0.0.0-...-9bfb934 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 1 Imported by: 0

README

PASH - Password Hasher

Simple password hashing and verification utility. Uses bcrypt.

There are 4 hashing options provided.

  1. HashMinCost(): uses bcrypt.MinCost currently 4 (at the time of writing)
  2. Hash(): uses bcrypt.DefaultCost currently 10
  3. HashMaxCost(): uses bcrypt.MaxCost currently 31
  4. HashWithCost(): accepts a variable cost factor. Use with care. The higher the cost factor, the more time it takes to yield a result (or crack).

Why?

Because I got tired of duplicating across pet projects.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(str string) (string, error)

Hash uses `bcrypt.DefaultCost` currently `10`

func HashMaxCost

func HashMaxCost(str string) (string, error)

HashMaxCost uses `bcrypt.MaxCost` currently `31`

func HashMinCost

func HashMinCost(str string) (string, error)

HashMinCost uses `bcrypt.MinCost` currently `4`

func HashWithCost

func HashWithCost(str string, cost int) (string, error)

HashWithCost accepts a variable cost factor. Use with care. The higher the cost factor, the more time it takes to yield a result (or crack).

func VerifyHash

func VerifyHash(hashedStr string, plainStr string) (bool, error)

VerifyHash takes the hashed string and the raw string, performs a comparison if hashes match. returns true if the do or false if not. Any errors will be returned as well.

Types

This section is empty.

Jump to

Keyboard shortcuts

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