phpass

package module
v0.0.0-...-356f10a Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 6 Imported by: 1

README

phpass

The PHPass password hashing standard (http://www.openwall.com/phpass/) implementing in go

Documentation

Overview

Package phpass Provides the ability to create and validate PHPass hashed passwords. See http://www.openwall.com/phpass/ for more details. The code here is more or less a direct port of the PHP implimentation found inside the official download. Or will be once it has been completed.

The code as it stands is not 100% complete in that it does not work with all of the options that can/should be speficied. It does work with the default options, and is compatible with WordPress's use of PHPass for hasing passwords in the database

Author: Bujosa

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Count     int
	Portable  bool
	Algorithm string
	Itoa      string
}

Config represents the configuration options that PHPass takes Note that these are, essentially, ignored right now.

func NewConfig

func NewConfig() *Config

NewConfig returnes a new defaulted config struct for use with New()

type Hash

type Hash struct {
	Config *Config
	MD5er  hash.Hash
}

Hash allows you to hash, and validate PHPass hashed passwords. The Hash structure is not thread safe. If you plan to use a single hasher you'll want to synchronize with your own syc.Mutex

func New

func New(config *Config) *Hash

New returns a new Hash structure against which you can make Hash() and Check() calls for creating and validating PHPass hashed passwords. If you pass nil as the config a default config will be provided for you.

func (*Hash) Check

func (h *Hash) Check(pw, pwhash []byte) bool

Check validates the given password against the given hash, returning true if they match, otherwise false

func (*Hash) Hash

func (h *Hash) Hash(pw []byte) ([]byte, error)

Hash takes a returns a PHPass hash given the input password

Jump to

Keyboard shortcuts

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