passwordHash

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: GPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

passwordHash

GoDoc Build Status Go Report Card

Password hashing package compatible with Node's password-hash

Usage

package main
import "github.com/malixsys/password-hash-go"

 func main() {
	 // Generate a hashed password
	 testPassword := `test1234`
	 hashedPassword := passwordHash.Generate(testPassword, nil)

	 // Test correct password in constant time
	 valid := passwordHash.Verify(hashedPassword, testPassword)
	 log.Printf("The password validity is %t against the hash", valid)

	 // Test incorrect password in constant time
	 valid, err = passwordHash.Verify(hashedPassword, "badPass")
	 log.Printf("The password validity is %t against the hash", valid)
 }

Development

Tests

Some tests are included

To run, use:

go test

TODO

  • Extend to other algorithms
  • More development info
  • More tests

Additional info

Documentation

Index

Constants

View Source
const ALGO = "whirlpool"

Variables

This section is empty.

Functions

func Generate

func Generate(pw string, options *GenerateOptions) string

func GenerateHash

func GenerateHash(pw string, salt string, iterations int) string

func GenerateSalt

func GenerateSalt(saltSize int) string

func IsHashed

func IsHashed(password string) bool

func Verify

func Verify(password string, hashedPassword string) bool

Types

type GenerateOptions

type GenerateOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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