README
¶
password
Implemented schemas
Safe schemas
- SHA256-CRYPT
$5$
https://www.akkadia.org/drepper/sha-crypt.html - SHA512-CRYPT
$6$
https://www.akkadia.org/drepper/sha-crypt.html - BLF-CRYPT / BCRYPT
$2a$
,$2$
,$2x$
,$2y$
,$2b$
Unsafe schemas
- MD5-CRYPT
$1$
- APR1
$apr1$
BLF-CRYPT apparent mess
BCrypt algorithm is secure but there was flaws in few implementations. This is the summary of the explanation of the different flavors of bcrypt :
$2$
may be produced by a buggy version who doesn't cope with UNICODE$2x$
is the PHP name for buggy$2$
$2y$
is the PHP name of$2a$
$2b$
is the bcrypt prefix used in OpendBSD for the corrected version of$2a$
(password length was limited to 255 bytes)
License
BSD-2
Documentation
¶
Index ¶
- Variables
- func Register(def ...Definition)
- func Set(pwd string) error
- func SetDefault(def Definition)
- type Crypter
- type Definition
- type Factory
- func (c *Factory) CrypterFound() Crypter
- func (c *Factory) FlagHelper() string
- func (p *Factory) MarshalText() ([]byte, error)
- func (c *Factory) Register(def ...Definition)
- func (c *Factory) Set(pwd string) error
- func (c *Factory) SetDefault(def Definition)
- func (c *Factory) String() string
- func (p *Factory) UnmarshalText(text []byte) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Crypter ¶
type Crypter interface { Salt(salt []byte) Crypter Hashed(pwd []byte) Crypter Crypt(pwd []byte) Crypter Verify(pwd []byte) bool Options() map[string]interface{} Definition() Definition encoding.TextMarshaler flag.Value }
func CrypterFound ¶
func CrypterFound() Crypter
type Definition ¶
type Definition interface { String() string CrypterFound(string) (Crypter, bool) Options() map[string]interface{} Default() Crypter SetOptions(map[string]interface{}) Definition Crypt(pwd, salt []byte, options map[string]interface{}) string }
var APR1 Definition = md5driver{apr1_prefix}
var BCRYPT Definition = register(bcryptdriver{bcrypt_prefix[0], bcrypt_def_cost})
var MD5 Definition = md5driver{md5_prefix}
var SHA256 Definition = register(sha256driver{sha256_def_rounds})
var SHA512 Definition = register(sha512driver{sha512_def_rounds})
type Factory ¶
type Factory struct { CustomFlagHelper func([]string) string // contains filtered or unexported fields }
Example ¶
Output: -password value type of password accepted : {SHA256-CRYPT}, {SHA512-CRYPT}, {BLF-CRYPT} this password is {BLF-CRYPT}
func (*Factory) CrypterFound ¶
func (*Factory) FlagHelper ¶
func (*Factory) MarshalText ¶
func (*Factory) Register ¶
func (c *Factory) Register(def ...Definition)
func (*Factory) SetDefault ¶
func (c *Factory) SetDefault(def Definition)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.