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
- func Generate(password string) (string, error)
- func GenerateWithSalt(password, salt string) (string, error)
- func NewCachedCrypto(crypto interfaces.Cryptographic) interfaces.Cryptographic
- func NewCrypto(alg types.Type, opts ...types.ConfigOption) (interfaces.Cryptographic, error)
- func RegisterAlgorithm(t types.Type, creator AlgorithmCreator, defaultConfig AlgorithmConfig)
- func UseCrypto(t types.Type, opts ...types.ConfigOption) error
- func Verify(hashed, password string) error
- type AlgorithmConfig
- type AlgorithmCreator
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 GenerateWithSalt ¶ added in v0.0.20
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
Types ¶
type AlgorithmConfig ¶ added in v0.0.21
type AlgorithmCreator ¶ added in v0.0.21
type AlgorithmCreator func(*types.Config) (interfaces.Cryptographic, error)
Click to show internal directories.
Click to hide internal directories.