hash

package
v0.0.0-...-b5b2af5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MIXCHARS is the number of characters to use in the mix
	MIXCHARS = 32
	// SALT_LENGTH is the length of the salt
	SALT_LENGTH = 20 //nolint: revive
	// ITERATION_MULTIPLIER is the number of iterations to use
	ITERATION_MULTIPLIER = 1000 //nolint: revive
)

Variables

View Source
var All = []Hash{
	&Plain{},
	&MySQL{},
	&MysqlNative{},
	&CachingSha2Password{},
	&Shadow{},
}

All 注册所有的hash方法 service模块可以通过hash的ID获取具体的hash实例

Functions

This section is empty.

Types

type CachingSha2Password

type CachingSha2Password struct {
}

func (*CachingSha2Password) ID

func (i *CachingSha2Password) ID() string

func (*CachingSha2Password) Match

func (i *CachingSha2Password) Match(hash, guess string) (flag bool, err error)

type Hash

type Hash interface {
	// ID 加密算法的ID
	ID() string

	// Match 密码匹配方式
	Match(hash, guess string) (flag bool, err error)
}

type MySQL

type MySQL struct {
}

func (*MySQL) ID

func (m *MySQL) ID() string

func (*MySQL) Match

func (m *MySQL) Match(hash, guess string) (flag bool, err error)

type MysqlNative

type MysqlNative struct {
}

func (*MysqlNative) ID

func (i *MysqlNative) ID() string

func (*MysqlNative) Match

func (i *MysqlNative) Match(hash, guess string) (flag bool, err error)

type Plain

type Plain struct {
}

func (*Plain) ID

func (i *Plain) ID() string

func (*Plain) Match

func (i *Plain) Match(hash, guess string) (flag bool, err error)

type Shadow

type Shadow struct {
}

func (*Shadow) ID

func (i *Shadow) ID() string

func (*Shadow) Match

func (i *Shadow) Match(hash, guess string) (flag bool, err error)

Jump to

Keyboard shortcuts

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