chhash

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WrongFormatPasswd = errors.New("wrong password format")
View Source
var WrongPasswd = errors.New("wrong password")

Functions

func Encode

func Encode(rawPwd []byte, options *Options) ([]byte, []byte)

Encode takes two arguments, a raw password, and a pointer to an Options struct. In order to use default options, pass `nil` as the second argument. It returns the generated salt and encoded supper_key for the user.

func Passwd

func Passwd(rawPwd string) string

Passwd sha512 default options. salt append const string chkey append encoded passwd

func Verify

func Verify(rawPwd, salt, encodedPwd []byte, options *Options) bool

Verify takes four arguments, the raw password, its generated salt, the encoded password, and a pointer to the Options struct, and returns a boolean value determining whether the password is the correct one or not. Passing `nil` as the last argument resorts to default options.

func VerifyPasswd

func VerifyPasswd(rawPwd string, encoded string) error

Types

type Options

type Options struct {
	SaltLen      int
	Iterations   int
	KeyLen       int
	HashFunction func() hash.Hash
}

Jump to

Keyboard shortcuts

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