Documentation
¶
Index ¶
- func HashApacheMD5(password string) (string, error)
- func HashBcrypt(password string) (string, error)
- func HashCrypt(password string) (string, error)
- func HashPassword(password string, hashType HashType) (string, error)
- func HashSHA1(password string) (string, error)
- func HashSHA256(password string) (string, error)
- func HashSHA512(password string) (string, error)
- func ValidatePassword(password string) error
- func ValidateUsername(username string) error
- func VerifyApacheMD5(password, hash string) bool
- func VerifyBcrypt(password, hash string) bool
- func VerifyCrypt(password, hash string) bool
- func VerifyPassword(password, hash string) bool
- func VerifySHA1(password, hash string) bool
- func VerifySHA256(password, hash string) bool
- func VerifySHA512(password, hash string) bool
- type Container
- func (c *Container) AddUser(username, hash string) error
- func (c *Container) AddUserPassword(username string, password string) error
- func (c *Container) AddUserWithHash(username string, password string, hashType HashType) error
- func (c *Container) Count() int
- func (c *Container) DeleteUser(username string) error
- func (c *Container) GetUser(username string) (*Entry, error)
- func (c *Container) ListUsers() []string
- func (c *Container) Read(src io.Reader) error
- func (c *Container) UserExists(username string) bool
- func (c *Container) VerifyUser(username string, password string) (bool, error)
- func (c *Container) Write(dest io.Writer) error
- type Entry
- type HashType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashApacheMD5 ¶
HashApacheMD5 implements Apache's MD5 algorithm
func HashBcrypt ¶
HashBcrypt hashes password using bcrypt
func HashPassword ¶
HashPassword hashes a password using the specified algorithm
func HashSHA256 ¶
HashSHA256 hashes password using SHA256
func HashSHA512 ¶
HashSHA512 hashes password using SHA512
func ValidatePassword ¶
ValidatePassword validates a password
func ValidateUsername ¶
ValidateUsername validates a username according to htpasswd rules
func VerifyApacheMD5 ¶
VerifyApacheMD5 verifies Apache MD5 hash
func VerifyPassword ¶
VerifyPassword verifies a password against a hash
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewFromFile ¶
NewFromFile creates a container from file
func NewFromReader ¶
NewFromReader creates a container from reader
func (*Container) AddUserPassword ¶
AddUserPassword adds a user and password with bcrypt
func (*Container) AddUserWithHash ¶
AddUserWithHash adds a user and password
func (*Container) DeleteUser ¶
DeleteUser removes a user entry
func (*Container) UserExists ¶
UserExists checks if a user exists
func (*Container) VerifyUser ¶
VerifyUser validate a user password
type HashType ¶
type HashType int
HashType represents the different hash algorithms supported
func DetectHashType ¶
DetectHashType detects the hash type from a hash string