hash

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package hash implements the functions, types, and interfaces for the module.

Package hash implements the functions, types, and interfaces for the module.

Package hash provides the hash functions

Index

Constants

View Source
const (
	// ENV environment variable name
	ENV = "ORIGADMIN_HASH_TYPE"
	// ErrPasswordNotMatch error when password not match
	ErrPasswordNotMatch = errors.String("password not match")
)

Variables

This section is empty.

Functions

func Generate

func Generate(password string) (string, error)

func GenerateWithSalt added in v0.0.20

func GenerateWithSalt(password, salt string) (string, error)

func NewCachedCrypto added in v0.0.20

func NewCachedCrypto(crypto interfaces.Cryptographic) interfaces.Cryptographic

func NewCrypto added in v0.0.20

func NewCrypto(alg types.Type, opts ...types.ConfigOption) (interfaces.Cryptographic, error)

NewCrypto creates a new cryptographic instance

func RegisterAlgorithm added in v0.0.20

func RegisterAlgorithm(t types.Type, creator AlgorithmCreator, defaultConfig AlgorithmConfig)

RegisterAlgorithm registers a new hash algorithm

func UseCrypto

func UseCrypto(t types.Type, opts ...types.ConfigOption) error

UseCrypto updates the default cryptographic instance

func Verify added in v0.0.20

func Verify(hashed, password string) error

Verify verifies a password

Types

type AlgorithmConfig added in v0.0.21

type AlgorithmConfig func() *types.Config

type AlgorithmCreator added in v0.0.21

type AlgorithmCreator func(*types.Config) (interfaces.Cryptographic, error)

Directories

Path Synopsis
algorithms
md5
sha
Package core implements the functions, types, and interfaces for the module.
Package core implements the functions, types, and interfaces for the module.
examples
hash command

Jump to

Keyboard shortcuts

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