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 implements the functions, types, and interfaces for the module.
Package hash provides the hash functions ¶
Package hash implements the functions, types, and interfaces for the module.
Package hash implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- Variables
- func AvailableAlgorithms() []types.Type
- func Generate(password string) (string, error)
- func GenerateWithSalt(password string, salt []byte) (string, error)
- func NewCachedVerifier(wrapped interfaces.Cryptographic) interfaces.Cryptographic
- func RegisterAlgorithm(algType types.Type, creator AlgorithmCreator, defaultConfig AlgorithmConfig)
- func RegisterAlgorithmResolver(name string, resolver interfaces.AlgorithmResolver)
- func ResolveType(algType types.Type) (types.Type, error)
- func UseCrypto(algName string, opts ...types.Option) error
- func Verify(hashed, password string) error
- type AlgorithmConfig
- type AlgorithmCreator
- type Crypto
Constants ¶
const (
// ENV environment variable name
ENV = "ORIGADMIN_HASH_TYPE"
)
Variables ¶
var ( // ErrHashModuleNotInitialized is returned when the hash module fails to initialize. ErrHashModuleNotInitialized = errors.ErrHashModuleNotInitialized )
Functions ¶
func AvailableAlgorithms ¶ added in v0.3.18
AvailableAlgorithms returns a list of all registered hash algorithms.
func Generate ¶
Generate generates a hash for the given password using the active cryptographic instance.
func GenerateWithSalt ¶
GenerateWithSalt generates a hash for the given password with the specified salt using the active cryptographic instance.
func NewCachedVerifier ¶ added in v0.3.18
func NewCachedVerifier(wrapped interfaces.Cryptographic) interfaces.Cryptographic
NewCachedVerifier creates a new cachedVerifier that wraps the given Cryptographic implementation.
func RegisterAlgorithm ¶
func RegisterAlgorithm(algType types.Type, creator AlgorithmCreator, defaultConfig AlgorithmConfig)
RegisterAlgorithm registers a new hash algorithm
func RegisterAlgorithmResolver ¶ added in v0.3.18
func RegisterAlgorithmResolver(name string, resolver interfaces.AlgorithmResolver)
RegisterAlgorithmResolver registers a resolver for a specific algorithm name.
Types ¶
type AlgorithmConfig ¶
type AlgorithmCreator ¶
type AlgorithmCreator func(algType types.Type, cfg *types.Config) (interfaces.Cryptographic, error)
AlgorithmCreator now accepts the full types.Type struct
Directories
¶
| Path | Synopsis |
|---|---|
|
algorithms
|
|
|
argon2
Package argon2 implements the functions, types, and interfaces for the module.
|
Package argon2 implements the functions, types, and interfaces for the module. |
|
blake2
Package blake2 implements the functions, types, and interfaces for the module.
|
Package blake2 implements the functions, types, and interfaces for the module. |
|
crc
Package crc implements the functions, types, and interfaces for the module.
|
Package crc implements the functions, types, and interfaces for the module. |
|
hmac
Package hmac implements the functions, types, and interfaces for the module.
|
Package hmac implements the functions, types, and interfaces for the module. |
|
pbkdf2
Package pbkdf2 implements the functions, types, and interfaces for the module.
|
Package pbkdf2 implements the functions, types, and interfaces for the module. |
|
ripemd160
Package ripemd160 implements the functions, types, and interfaces for the module.
|
Package ripemd160 implements the functions, types, and interfaces for the module. |
|
sha
Package sha implements the functions, types, and interfaces for the module.
|
Package sha implements the functions, types, and interfaces for the module. |
|
examples
|
|
|
hash
command
Package main provides an example of using the hash package
|
Package main provides an example of using the hash package |
|
Package interfaces implements the functions, types, and interfaces for the module.
|
Package interfaces implements the functions, types, and interfaces for the module. |
|
internal
|
|
|
validator
Package validator implements the functions, types, and interfaces for the module.
|
Package validator implements the functions, types, and interfaces for the module. |
|
Package types implements the functions, types, and interfaces for the module.
|
Package types implements the functions, types, and interfaces for the module. |