Documentation
¶
Index ¶
- type Config
- type ConfigOption
- func WithCost(cost int) ConfigOption
- func WithMemoryCost(cost uint32) ConfigOption
- func WithSalt(salt string) ConfigOption
- func WithSaltLength(length int) ConfigOption
- func WithScryptConfig(scrypt ScryptConfig) ConfigOption
- func WithThreads(threads uint8) ConfigOption
- func WithTimeCost(cost uint32) ConfigOption
- type HashParts
- type ScryptConfig
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
TimeCost uint32 `env:"HASH_TIMECOST"`
MemoryCost uint32 `env:"HASH_MEMORYCOST"`
Threads uint8 `env:"HASH_THREADS"`
SaltLength int `env:"HASH_SALTLENGTH"`
KeyLength uint32 `env:"HASH_KEYLENGTH"`
Cost int `env:"HASH_COST"` // Cost parameter (for bcrypt)
Salt string `env:"HASH_SALT"` // Salt for HMAC
Scrypt ScryptConfig
}
Config represents the configuration for hash algorithms
type ConfigOption ¶
type ConfigOption func(*Config)
ConfigOption is a function that modifies a Config
func WithMemoryCost ¶
func WithMemoryCost(cost uint32) ConfigOption
WithMemoryCost sets the memory cost
func WithSaltLength ¶
func WithSaltLength(length int) ConfigOption
WithSaltLength sets the salt length
func WithScryptConfig ¶
func WithScryptConfig(scrypt ScryptConfig) ConfigOption
WithScryptConfig sets the scrypt configuration
func WithThreads ¶
func WithThreads(threads uint8) ConfigOption
WithThreads sets the number of threads
type ScryptConfig ¶
type ScryptConfig struct {
N int `env:"HASH_SCRYPT_N"`
R int `env:"HASH_SCRYPT_R"`
P int `env:"HASH_SCRYPT_P"`
}
ScryptConfig represents the configuration for Scrypt algorithm
type Type ¶
type Type string
Type represents the hash algorithm type
const ( // TypeCustom custom type TypeCustom Type = "custom" // TypeMD5 md5 type TypeMD5 Type = "md5" // TypeSha1 sha1 type TypeSha1 Type = "sha1" // TypeSha256 sha256 type TypeSha256 Type = "sha256" // TypeSha512 sha512 type TypeSha512 Type = "sha512" // TypeSha384 sha384 type TypeSha384 Type = "sha384" // TypeSha3256 sha3-256 type TypeSha3256 Type = "sha3-256" // TypeArgon2 argon2 type TypeArgon2 Type = "argon2" // TypeScrypt scrypt type TypeScrypt Type = "scrypt" // TypeBcrypt bcrypt type TypeBcrypt Type = "bcrypt" // TypeHMAC256 hmac sha256 type TypeHMAC256 Type = "hmac256" // TypeHMAC512 hmac sha512 type TypeHMAC512 Type = "hmac512" // TypePBKDF2 pbkdf2 type TypePBKDF2 Type = "pbkdf2" // TypePBKDF2SHA256 pbkdf2 sha256 type TypePBKDF2SHA256 Type = "pbkdf2-sha256" // TypePBKDF2SHA512 pbkdf2 sha512 type TypePBKDF2SHA512 Type = "pbkdf2-sha512" // TypePBKDF2SHA384 pbkdf2 sha384 type TypePBKDF2SHA384 Type = "pbkdf2-sha384" // TypePBKDF2SHA3256 pbkdf2 sha3-256 type TypePBKDF2SHA3256 Type = "pbkdf2-sha3-256" // TypePBKDF2SHA3224 pbkdf2 sha3-224 type TypePBKDF2SHA3224 Type = "pbkdf2-sha3-224" // TypePBKDF2SHA3384 pbkdf2 sha3-384 type TypePBKDF2SHA3384 Type = "pbkdf2-sha3-384" // TypePBKDF2SHA3512224 pbkdf2 sha3-512-224 type TypePBKDF2SHA3512224 Type = "pbkdf2-sha3-512-224" // TypePBKDF2SHA3512256 pbkdf2 sha3-512-256 type TypePBKDF2SHA3512256 Type = "pbkdf2-sha3-512-256" // TypePBKDF2SHA3512384 pbkdf2 sha3-512-384 type TypePBKDF2SHA3512384 Type = "pbkdf2-sha3-512-384" // TypePBKDF2SHA3512512 pbkdf2 sha3-512-512 type TypePBKDF2SHA3512512 Type = "pbkdf2-sha3-512-512" // TypeUnknown unknown type TypeUnknown Type = "unknown" )
Click to show internal directories.
Click to hide internal directories.