Documentation ¶
Index ¶
- Variables
- func Compare(ctx context.Context, password []byte, hash []byte) error
- func CompareArgon2i(_ context.Context, password []byte, hash []byte) error
- func CompareArgon2id(_ context.Context, password []byte, hash []byte) error
- func CompareBcrypt(_ context.Context, password []byte, hash []byte) error
- func CompareFirebaseScrypt(_ context.Context, password []byte, hash []byte) error
- func CompareHMAC(_ context.Context, password []byte, hash []byte) error
- func CompareMD5(_ context.Context, password []byte, hash []byte) error
- func CompareMD5Crypt(_ context.Context, password []byte, hash []byte) error
- func ComparePbkdf2(_ context.Context, password []byte, hash []byte) error
- func CompareSHA(_ context.Context, password []byte, hash []byte) error
- func CompareSHA256Crypt(_ context.Context, password []byte, hash []byte) error
- func CompareSHA512Crypt(_ context.Context, password []byte, hash []byte) error
- func CompareSSHA(_ context.Context, password []byte, hash []byte) error
- func CompareScrypt(_ context.Context, password []byte, hash []byte) error
- func IsArgon2iHash(hash []byte) bool
- func IsArgon2idHash(hash []byte) bool
- func IsBcryptHash(hash []byte) bool
- func IsFirebaseScryptHash(hash []byte) bool
- func IsHMACHash(hash []byte) bool
- func IsMD5CryptHash(hash []byte) bool
- func IsMD5Hash(hash []byte) bool
- func IsPbkdf2Hash(hash []byte) bool
- func IsSHA256CryptHash(hash []byte) bool
- func IsSHA512CryptHash(hash []byte) bool
- func IsSHAHash(hash []byte) bool
- func IsSSHAHash(hash []byte) bool
- func IsScryptHash(hash []byte) bool
- func IsValidHashFormat(hash []byte) bool
- func NewCryptDecoder() *crypt.Decoder
- type Argon2
- type Argon2Configuration
- type Bcrypt
- type BcryptConfiguration
- type HashProvider
- type Hasher
- type Pbkdf2
- type Scrypt
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidHash = errors.New("the encoded hash is not in the correct format") ErrIncompatibleVersion = errors.New("incompatible version of argon2") ErrMismatchedHashAndPassword = errors.New("passwords do not match") )
View Source
var CryptDecoder = NewCryptDecoder()
View Source
var ErrUnknownHashAlgorithm = errors.New("unknown hash algorithm")
Functions ¶
func CompareFirebaseScrypt ¶ added in v0.11.0
func CompareHMAC ¶ added in v1.1.0
func CompareMD5 ¶ added in v0.11.0
func CompareMD5Crypt ¶ added in v1.0.0
func CompareSHA ¶ added in v0.13.0
func CompareSHA256Crypt ¶ added in v1.0.0
func CompareSHA512Crypt ¶ added in v1.0.0
func CompareSSHA ¶ added in v0.13.0
func CompareScrypt ¶ added in v0.11.0
func IsArgon2iHash ¶
func IsArgon2idHash ¶
func IsBcryptHash ¶
func IsFirebaseScryptHash ¶ added in v0.11.0
func IsHMACHash ¶ added in v1.1.0
func IsMD5CryptHash ¶ added in v1.0.0
func IsPbkdf2Hash ¶
func IsSHA256CryptHash ¶ added in v1.0.0
func IsSHA512CryptHash ¶ added in v1.0.0
func IsSSHAHash ¶ added in v0.13.0
func IsScryptHash ¶ added in v0.11.0
func IsValidHashFormat ¶ added in v0.13.0
func NewCryptDecoder ¶ added in v1.0.0
Types ¶
type Argon2 ¶
type Argon2 struct {
// contains filtered or unexported fields
}
func NewHasherArgon2 ¶
func NewHasherArgon2(c Argon2Configuration) *Argon2
func (*Argon2) Understands ¶
type Argon2Configuration ¶
type Bcrypt ¶
type Bcrypt struct {
// contains filtered or unexported fields
}
func NewHasherBcrypt ¶
func NewHasherBcrypt(c BcryptConfiguration) *Bcrypt
func (*Bcrypt) Understands ¶
type BcryptConfiguration ¶
type HashProvider ¶
type Hasher ¶
type Hasher interface { // Generate returns a hash derived from the password or an error if the hash method failed. Generate(ctx context.Context, password []byte) ([]byte, error) // Understands returns whether the given hash can be understood by this hasher. Understands(hash []byte) bool }
Hasher provides methods for generating and comparing password hashes.
Click to show internal directories.
Click to hide internal directories.